Div布局案例


通常看到這個頁面,會想到它是有幾塊組成的。

第一塊,分銷佣金。

第二塊,包括代言、商品、二維碼

其中代言又是左右結構。

於是乎基本的div結構就出來了。

<div class="row_1">
  
</div>

<div class="row_2">
  <div clas="row_2_1">
  
  </div>
  <div class="row_2_2">
    
  </div>
  <div class="row_2_3">

  </div>

</div>

<div class="row_3">
    
</div>

然后逐層的添加與調整。

<div class="row_1">
  <div class="left"><img class="money_img" src="{sh::PRES}public/img/t2.png"></span></div>
  <div class="right">
  <div class="money">分銷佣金<font color='#CC0000'>{sh:$commission}</font></div>
  <div class="sale">已銷售<font color='#CC0000'><php>echo ($goodsData['salecount'] + $goodsData['fakemembercount']);</php></font></div>
  </div>
</div>

<div class="row_2">
  <div clas="row_2_1">
  <div class="left"><img src="{sh:$wxuserData.headimgurl}" width="70px" class="headimg"></div>
  <div class="popover right">
      <div class="arrow"></div>
      <div class="popover-content">
          <p>我是<font color='#FF9900'>{sh:$wxuserData.nickname}</font><br/><span>我為<font color='#FF9900'>{sh:$storeData.name}</font>代言。</span></p>
      </div>
  </div>
  </div>
  <div class="row_2_2">
    <div class="item-img">
        <img class="item-img-logo"  src="{sh:$goodsData.logoimg}" width="100%">
        <div class="item-bottom">
            <span>{sh:$goodsData.name}</span>
            <div>
            <span class="price">&yen;<strong>{sh:$goodsData.price}</strong></span>
            <small><s>&yen;{sh:$goodsData.oprice}</s></small>
            </div>
        </div>
    </div>
  </div>
  <div class="row_2_3 qrcode">
  <img src="{sh:$goodsData.qrcode}" width="100%">
  <strong>長按二維碼&nbsp;識別圖中二維碼</strong>
  </div>

</div>

<div class="row_3 tip">
    <div class="title">
        <i class="fa fa-sitemap"></i><span>&nbsp;分銷如何賺錢</span>
    </div>
    <div class="content">
        <div>
            <strong>第一步:</strong>轉發商品鏈接或商品二維碼圖片給微信好友;<br/><br/>
            <strong>第二步:</strong>從您轉發的鏈接或圖片進入商城的好友,系統將自動鎖定成為您的客戶,他們在微信商城中購買任何商品,您都可以獲得分銷佣金;<br/><br/>
            <strong>第三步:</strong>您可以在分銷中查看【我的團隊】和【分銷佣金】。好友確認收貨后,佣金可提現。<br/><br/>
        </div>
    </div>
</div>

css最好寫到style中

<style>
    body{
        background-color: #EFEFEF;
    }
    .item-bottom{
        position: absolute;
        left: 0px;
        bottom: 0px;
        background: rgba(0,0,0,0.4) none repeat scroll !important;
        width: 100%;
        color: #fff;
        line-height: 25px;
        padding-right: 5px;
        text-align: left;
        font-size: 13px;
        padding-left: 10px;
    }
    .qrcode{text-align: center;}
    .qrcode img{width:95%;}
    .qrcode strong{color:#cc0033;text-align:center;padding:20px;display:block}

    .tip .title{height:30px;margin:10px;vertical-align:middle;line-height:30px;}
    .tip .title img{padding: 5px;float:left;}
    .tip .title div{width:100%;margin-left:5px;height:1px;background-color: #cc0033;}

    .tip .content{margin-left:15px;margin-right:15px;color:gray;}
    .tip .content strong{color:black;}
    .row_1{
        width:100%;display: inline-flex;background-color: white;margin-bottom: 15px;
    }
    .row_2{
        width:100%;position: relative;background-color: white;
    }
    .row_2_1{
        display: inline-flex;margin-bottom: 10px;
    }
    .popover{
        display: inline;left:80px;top:10px;width:70%;
    }
    .headimg{
        margin: 10px 10px;
    }
    .item-img{
        position: relative;
    }
    .price{
        color:#CC3300; font-size: 16px;
    }
    .money{
        display: inline-grid;font-size: 25px;padding:10px 5px 5px 5px;
    }
    .sale{
        font-size: 18px;padding-left:10px;color:gray;
    }
    .money_img{
        width: 80px;
        padding: 5px;
    }
    .popover-content{
        font-size: 14px;
    }
</style>

如果很多的話,可以寫到一個單獨的css文件中,引入進來。

tips:

頁面或者功能實現之后,這是第一步。

最好能夠繼續優化一下頁面與代碼。

將沒用的去除,或者將代碼進行優化調整。這是一個好習慣。

不管怎樣,搞出來就是最牛逼的。優化是在搞出來基礎上去做的事情。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM