【CSS基礎】廣告位兩欄布局

來源:互聯網
上載者:User

標籤:font   class   ble   youdao   20px   body   com   技術   osi   

【問題描述】左側文字,右側圖片。 左側上方為廣告描述,下方為“廣告   ×”。 上方廣告描述可能為一行,兩行,三行;下方“廣告”  和  “ ×” 的相對位置不同,。

 

在看參考代碼前,可自己先試著寫寫。

=====================================

 

【參考代碼】

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta http-equiv="X-UA-Compatible" content="IE=edge">    <meta name="viewport" content="width=device-width, initial-scale=1">    <title>廣告</title>    <style>        .section {            line-height: 40px;            font-size: 15px;            text-align: justify;            margin: 10px 0;            position: relative;        }        .relative {            position: relative;        }        .clear-fix:after {            clear: both;            content: "";            display: block;        }        .right-img {            float: right;            width: 150px;            height: 120px;        }        .left-txt {            margin-right: 150px;        }        .left-txt .p-txt {            min-height: 80px;        }        .right-img img {            width: 100%;            height: 100%;        }        .pull-right{            float: right;        }    </style></head><body>    <div class="section clear-fix">        <div class="right-img">            <img src="head.jpg" alt="頭像">        </div>        <div class="left-txt">            <div class="p-txt">去哪兒旅行頻道在旅遊攻略。</div>        </div>        <span class="relative">廣告</span>        <span class="pull-right">×</span>    </div>    <div class="section clear-fix">        <div class="right-img">            <img src="head.jpg" alt="頭像">        </div>        <div class="left-txt">            <div class="p-txt">去哪兒旅行頻道在旅遊攻略。去哪兒旅行頻道在旅遊攻略。</div>        </div>        <span class="relative">廣告</span>        <span class="pull-right">×</span>    </div>    <div class="section clear-fix">        <div class="right-img">            <img src="head.jpg" alt="頭像">        </div>        <div class="left-txt">            <div class="p-txt">去哪兒旅行頻道在旅遊攻略。去哪兒旅行頻道在旅遊攻略。攻略</div>        </div>        <span class="relative">廣告</span>        <span class="pull-right">×</span>    </div></body></html>

 

【CSS基礎】廣告位兩欄布局

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.