F2E合作社|交錯漂浮版|網頁切版


Posted by itiswonderfall on 2021-11-24

CSS

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
<style>
    * {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    body {
        padding: 100px 0;
        background: linear-gradient(20deg, #3d5493, #1aa2a0) fixed center center / 100% 100%;
    }
    .wrap {
        width: 1200px;
        margin: auto;
    }
    .item {
        display: flex;
        align-items: center;
        margin-bottom: 70px;
        font-family: 'Noto Sans TC', sans-serif;
    }
    .item h2 {
        font-weight: 900;
    }
    .item p {font-weight: 500;}
    .item .pic {
        width: 55%;
        flex-shrink: 0;
    }
    .item .pic img {
        width: 100%;
        vertical-align: middle;
    }
    .item .txt {
        width: 55%;
        flex-shrink: 0;
        padding: 50px 30px;
        box-sizing: border-box;
        position: relative;
        z-index: 1;
    }
    .item > :first-child {
        margin-right: -10%;
    }
    .item:nth-child(1) .txt {
        background-color: rgba(240, 174, 193, .8);
    }
    .item:nth-child(2) .txt {
        background-color: rgba(42, 253, 208, .8);
    }
</style>

HTML

<div class="wrap">
    <div class="item">
        <div class="pic">
            <img src="https://picsum.photos/600/350?ramdom=10">
        </div>
        <div class="txt">
            <h2>Item 1</h2>
            <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Saepe ipsum ad consectetur dolorem dolores voluptatem odio provident, labore? Nobis, quibusdam. Cum, necessitatibus eos sit sunt doloribus. Natus praesentium beatae odit.</p>
        </div>
    </div>
    <div class="item">
        <div class="txt">
            <h2>Item 2</h2>
            <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Saepe ipsum ad consectetur dolorem dolores voluptatem odio provident, labore? Nobis, quibusdam. Cum, necessitatibus eos sit sunt doloribus. Natus praesentium beatae odit.</p>
        </div>
        <div class="pic">
            <img src="https://picsum.photos/600/350?ramdom=20">
        </div>
    </div>
</div>

最後奉上 CSScoke 的影片教學

 


 

資料來源

金魚都能懂的網頁切版 : 交錯漂浮版 NO004 | 切版教學 | HTML教學 | 網頁教學 | 網頁切版


#f2e #F2E合作社 #網頁切版 #交錯漂浮







Related Posts

JQ總務處|jQuery事件與函式|深入淺出jQuery

JQ總務處|jQuery事件與函式|深入淺出jQuery

學習 Git (6) - 修改 commit 紀錄 part 3:Rebase

學習 Git (6) - 修改 commit 紀錄 part 3:Rebase

JavaScript 迴圈 -親愛的,我逃不出這個循環

JavaScript 迴圈 -親愛的,我逃不出這個循環


Comments