CSS实操一,实现商城购物模块(实战知识点。最基础css+div实现)

实现商城购物的效果

 代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小米商城手机模块实战</title>
    <style>
/*<!--    0 ruto 是设置居中显示    -->*/
/*设置了一个总的容器,居中显示,高度800,宽度500,颜色灰色 居中显示  文字也是居中显示*/
/*在总体里面设置了一下居中显示 所以这个模块里面的所有子容器都继承了*/
        .root{
            width: 800px;
            height: 500px;
            background-color: gray;
            margin: 0 auto;
            text-align: center;
        }
        /*float 是设置为靠左   mragin-top 是设置考上10边距  margin-left 时设置靠左10边距*/
        .left{
            float: left;
            margin-top: 3.5%;
            margin-left: 2%;
            width: 20%;
            height: 96%;
            /*background-color: #4135fa;*/
        }
        /*设置右边  靠右 高度距离上边框10 距离右边框10 整体宽度占据总体的百分之75 总体高度占据总体的百分之96*/
        /*设置一个颜色看看有无设置成功*/
        .right{
            float: right;
            margin-top: 2%;
            margin-right: 2%;
            width: 75%;
            height: 96%;
            /*background-color: #ffcccc;*/
        }
        /*设置子键位置,因为所有的值模块都是一样的,所有我们可以统一设置一下*/
        .top-1{
            float: left;
            margin-top: 2%;
            margin-left: 2%;
            width: 23%;
            height: 47%;
            background-color: white;
        }
    </style>
</head>
<body>
<div class="root">

    <div class="left">
<!--        插入图片,微调一下,使之更加美观-->
        <img src="手机1.png" alt="" style="float: left" width="160px" height="465px">
    </div>
    <div class="right">
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
             <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
        <div class="top-1">
            <img src="手机2.png" alt="" style="margin-top: 20px" width="80px" height="120px">
            <br>
            <br>
            <b>黑煞4s</b><br>
            <p>磁动力升降肩键</p>
        </div>
    </div>
</div>
</body>
</html>

图片地址请自行更换本地的地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值