网页热卖商品模块(栅格系统)

技术要点:Bootstrap栅格系统
页面结构
在这里插入图片描述
实现步骤:
在这里插入图片描述
实现代码展示:

<!DOCTYPE html>
<html>
<head>
<title>网页热卖商品模块</title>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="lib/html5shiv/html5shiv.min.js"></script>
<script src="lib/respond/respond.min.js"></script>
<![endif]-->
<style>
    body,h3,h6{
        font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
    }
@media screen and (min-width:992px) {
    img{
    width: 200px;
    height: 200px;
}
.glyphicon{
    color:green;
    margin: 10px;
    display: block;
}
.btn{
    width: 200px;
    height: 30px;
    font-size: 15px;
    margin: 0px;
    background-color: red;
    color: white;
    display: block;
}
h6{
    color: red;
}
}
@media screen and (max-width:992px){
img{
    width: 300px;
    height: 300px;
}
.glyphicon{
    color:green;
    margin: 10px;
    display: block;
    font-size: 15px;
}
.btn{
    width: 300px;
    background-color: red;
}
.col-sm-4{
    width: 500px;
}
h6{
    color: red;
}
}
@media screen and (max-width:768px){
    img{
    width: 200px;
    height: 200px;
}
.glyphicon{
    color:green;
    margin: 10px;
    display: block;
}
.btn{
    width: 200px;
    height: 30px;
    font-size: 15px;
    background-color: red;
    color: white;
    display: block;
}
h6{
    color: red;
}
}
</style>
</head>
<body>
    <div class="hot">
        <div class="container">
            <div class="container">
                <div class="row">
                  <div class="col-sm-4">
                    <h3>米西奈斯煎饼</h3>
                    <img src="image/煎饼.jpg" alt="">
                    <div class="glyphicon glyphicon-thumbs-up">两种口味可供选择</div>
                    <button type="button" class="btn btn-secondary btn-lg btn-block">添加到购物车</button>
                    <h6>一口价:¥45.00</h6>
                  </div>
                  <div class="col-sm-4">
                    <h3>蒙特斯大虾</h3>
                    <img src="image/大虾.jpg" alt="">
                    <div class="glyphicon glyphicon-thumbs-up">两种口味可供选择</div>
                    <button type="button" class="btn btn-secondary btn-lg btn-block">添加到购物车</button>
                    <h6>一口价:¥65.00</h6>
                  </div>
                  <div class="col-sm-4">
                   <h3>香鲜鸡排</h3>
                   <img src="image/鸡排.jpg" alt="">
                   <div class="glyphicon glyphicon-thumbs-up">两种口味可供选择</div>
                   <button type="button" class="btn btn-secondary btn-lg btn-block">添加到购物车</button>
                   <h6>一口价:¥55.00</h6>
                  </div>
                </div>
              </div>
        </div>
    </div>
      
    <script src="bootstrap-3.3.7/js/jquery.min.js"></script>
    <script src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

当浏览器窗口大于等于992px时:
在这里插入图片描述
当浏览器小于992px时:
在这里插入图片描述
当浏览器小于768px时:
在这里插入图片描述
在此次任务的难点在于浏览器窗口变化的样式,.col-sm-4{ width: 500px;}这句为关键。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值