前台小模組CSS布局代碼

來源:互聯網
上載者:User
結構代碼如下:        <div class="box">
          <h4>標題</h4>
          <dl class="title">
            <dd>更多</dd>
          </dl>
          <div class="content">
          內容
          </div>
        </div>

css代碼:1     *{ margin:0; padding:0;}
2     .box{width:200px;position:relative;}
3     .box h4{height:26px; background:#f00; line-height:25px;}
4     .title{position:absolute; top:1px;  right:3px;line-height:25px;}
5     .content{border:1px solid #CCDFF2;overflow:hidden;}

注意 *{ margin:0; padding:0;}是必須的  還有就是box的position:relative;是必須的  不然當你絕對位置“更多”時會出問題 
這樣  我們要建這樣的小模組  就很爽了  只要複製  修改  ,還可以在h4上用漂亮的背景圖
好了附圖我美化過的;

相關文章

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.