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:

复制代码
页面或者功能实现之后,这是第一步。

最好能够继续优化一下页面与代码。

将没用的去除,或者将代码进行优化调整。这是一个好习惯。

不管怎样,搞出来就是最牛逼的。优化是在搞出来基础上去做的事情。
复制代码
相关文章
|
SQL 关系型数据库 SDN
双活中心数据一致性
双活中心数据一致性
696 2
|
缓存 数据库
定时器的应用场景?
定时器的应用场景?
1029 0
|
机器学习/深度学习 人工智能 自然语言处理
当前AI大模型在软件开发中的创新应用与挑战
2024年,AI大模型在软件开发领域的应用正重塑传统流程,从自动化编码、智能协作到代码审查和测试,显著提升了开发效率和代码质量。然而,技术挑战、伦理安全及模型可解释性等问题仍需解决。未来,AI将继续推动软件开发向更高效、智能化方向发展。
|
NoSQL 前端开发 rax
Dev 日志 | 一次 Segmentation Fault 和 GCC Illegal Instruction 编译问题排查
本文记录了 Segmentation fault (core dumped) 和 internal compiler error: Illegal instruction 两个错误信息的 Debug 过程
2912 0
Dev 日志 | 一次 Segmentation Fault 和 GCC Illegal Instruction 编译问题排查
|
机器学习/深度学习 人工智能 数据可视化
小滑块上个斜面,难倒多少高中生?现在,AI让它动起来了
《Augmented Physics:基于机器学习的物理学习工具》 高中物理学习中,小滑块上斜面等问题常让学生困惑。Augmented Physics利用AI技术,将静态物理图示转化为交互式模拟,通过增强实验、动画图示、双向操作和参数可视化等技术,帮助学生直观理解物理概念。研究表明,该工具能有效提升学生对物理概念的理解,具备广阔的应用前景。
285 1
|
存储 前端开发 Oracle
swap去中心化交易所系统开发逻辑设计及源码示例
在开发去中心化交易所(DEX)的Swap系统时,逻辑设计至关重要,涉及系统架构、核心模块和交易流程等关键环节。系统分为前端界面、后端服务和区块链层,涵盖用户管理、交易处理和智能合约等功能。本文还提供了使用Solidity编写的Swap智能合约的简化示例,展示了代币兑换的基本逻辑。
|
网络协议 算法 网络性能优化
【TCP】核心机制:滑动窗口、流量控制和拥塞控制
【TCP】核心机制:滑动窗口、流量控制和拥塞控制
307 2
|
Python
Matplotlib 教程 之 Matplotlib 中文显示 1
Matplotlib 中文显示教程:介绍如何在 Matplotlib 中正确显示中文,包括设置 Matplotlib 字体参数和下载支持中文的字体库。通过获取系统字体库列表,选择合适的中文字体进行配置。
284 0
|
机器学习/深度学习 数据采集 存储
【机器学习6】数据预处理(三)——处理类别数据(有序数据和标称数据)
【机器学习6】数据预处理(三)——处理类别数据(有序数据和标称数据)
512 0
|
JavaScript 前端开发
网页前端课程设计-【模仿】香港中文大学官网,轮播图及div+css布局,js的dom操作
这篇文章介绍了如何模仿香港中文大学官网进行网页前端课程设计,包括使用div+css布局、js的DOM操作以及实现轮播图等技术细节。