会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132358个问题
WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 107楼

elc-box中最后一个盒子中 浏览更多 设置宽高不生效 字体图标大小也不生效(字体图标不显示这个问题也有疑问)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小米广告部分</title>
    <link rel="icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="小米.css">
</head>
<body>
<div class="content">
        <div class="wrap">
         <!-- 家电部分 -->
            <div class="elc">
                <div class="elc-nav">
                    <a href="#">
                        <img src="../images/41d16e66381cfeda7b6b39ab67678d5e.jpg" alt="">  
                    </a>
                </div>     
                <h2 class="title">家电
                    <a href="#">
                        <span>热门</span>
                        <span>电视影音</span>
                    </a>
                </h2>
                <div class="elc-box">
                    <div class="items-2">
                        <a href="#">
                            <img src="../images/116fc43816b87192be4e67cf762e8da5.jpeg" alt="">
                         </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/03a9e7e96a09d256ca1badeec186c859.jpg" alt=""  class="img1">
                                <h3 class="name2">小米全面屏电视65英寸 E65X </h3>
                                <p class="desc2">全面屏设计</p>
                                <p class="price2">2999元<del class="original">3299元</del></p>
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/20d36fbaa18625e4fe507af31e4e9f83.jpg" alt="" class="img1">
                            <h3 class="name2">全面屏电视E43K  </h3>
                            <p class="desc2">全面屏设计,海量内容</p>
                            <p class="price2">1349元<del class="original">1500元</del></p>
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/9d8674cd21c486feff5328772ab9cf01.jpg" alt="" class="img1">
                            <h3 class="name2">小小米电视4A 70英寸 </h3>
                            <p class="desc2">大屏更享受</p>
                            <p class="price2">3599元<del class="original">3900元</del></p>
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/6bed167fc905bab57dee478bcf1e5e0d.JPG" alt="" class="img1">
                            <h3 class="name2">米家互联网对开门冰箱 540L </h3>
                            <p class="desc2">重磅新品福利特惠</p>
                            <p class="price2">2999元<del class="original">3600元</del></p>
                        </a>
                    </div>
                    <div class="items-2">
                        <a href="#">
                            <img src="../images/dfbdabe36b2d630d57a015e6fb5eb3ea.jpg" alt="">
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/b8c63a2024528fe5410ebe669b7d2407.jpg" alt="" class="img1">
                            <h3 class="name2">Redmi全自动波轮洗衣机1A 8kg</h3>
                            <p class="desc2">一键操作,父母都爱用</p>
                            <p class="price2">849元<del class="original">899元</del></p>
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/74e573c4c0d89048392d14831cc507d5.jpg" alt="" class="img1">
                            <h3 class="name2">Air 13.3" 2019款 </h3>
                            <p class="desc2">新一代独立显卡</p>
                            <p class="price2">6299元</p>
                        </a>
                    </div>
                    <div class="items-1">
                        <a href="#">
                            <img src="../images/7e5f89adf98ab3fccb34012b5209cd58.jpg" alt="" class="img1">
                            <h3 class="name2">米家互联网烟灶套装(天然气)</h3>
                            <p class="desc2">点火排烟,风随火动</p>
                            <p class="price2">2298元</p>
                        </a>
                    </div>
                    <div class="items-last">
                        <div>
                            <a href="#">
                                <img src="../images/1612c93ad4756215774a0dbec7a81bb2.jpg" alt="">
                                <h3 class="name2">米家电烤箱 </h3>
                                <p class="price2">279元</p>
                            </a>
                        </div>
                        <div>
                            <a href="#">
                                <div class="more">浏览更多
                                    <small>电视影音</small>
                                </div>
                                <i class="icontfont">&#xe619;</i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
          </div>
       </div>
.elc-nav{
    width:100%;
    height:120px;
    margin:22px 0;
}
.title{
    color:#333;
    font-size:22px;
    font-weight:200;
    line-height:58px;
    text-align:left;
}
.title>a{
    color:#424242;
    font-size:12px;
    line-height:58px;
    float:right;
}
.title>a:hover{
    color:#ff6700;
}
.elc-box{
    width:100%;
    height:614px;
}
.items-1{
    width:234px;
    height:260px;
    background-color:#fff;
    margin:0 0 14px 14px;
    padding:20px 0;
    text-align:center;
    float:left;
    transition:all .2s linear;
}
.img1{
    width:160px;
    height:160px;
    margin-bottom:18px;
}
.name2{
    width: 214px;
    height: 21px;
    color: #333;
    font-size: 14px;
    line-height: 21px;
    margin: 0 auto 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.desc2{
    width: 214px;
    height: 18px;
    color: #b0b0b0;
    font-size: 12px;
    line-height: 18px;
    margin: 0 auto 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.price2{
    color: #ff6700;
    font-size: 14px;
}
.title span{
    margin-left:30px;
    transition:border .3s;
}
/* 鼠标悬停在家电标题右侧部分的span元素上,橘色的下边框显示 */
.title span:hover{
    border-bottom:2px solid #ff6700;
}
.items-2{
    width:234px;
    height:300px;
    background-color:#fff;
    margin-left:0;
    padding:0;
    float:left;
}
.items-last{
    width:234px;
    height:300px;
    margin-left:14px;
    float:left;
    position:relative;
}
.items-last>div{
    width:234px;
    height:143px;
    background-color:#fff;
    padding-top:50px;
    box-sizing:border-box;
}
.items-last>div:first-child{
    margin-bottom: 14px;
}
.items-last>div:last-child>.more{
    width:94px;
    height:45px;
    font-size:18px;
    color:#333;
    margin:0 110px 0 30px;
    float:left;
}
.more>small{
    display:block;
    color:#757575;
    font-size:12px;
}
.items-last>div:last-child>i{
    /* 转化为块级元素设置宽高 */
    display:block;
    color:#ff6700;
    font-size:48px;
    line-height:48px;
    float:left;
}
.items-2 img{
    width:100%;
    height:100%;
}
.price2>del{
    color: #b0b0b0;
    margin-left:0.5em;
}
.items-last img{
    width:80px;
    height:80px;
    position:absolute;
    top:32px;
    right:20px;
}
.items-last h3{ 
    position:absolute;
    top:50px;
    left:-40px;
}
.items-last p{
    position:absolute;
    top:76px;
    left:40px;
}
/* 鼠标悬停在家电部分主体小盒子上,均有三个方向上的盒阴影 */
.items-1:hover,.items-2:hover,.items-last>div:hover{
    box-shadow:0 15px 30px rgba(0,0,0,.1);
    transform:translate(0,-2px);
}

1618631689716371.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 108楼

   <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: aliceblue;
        }

        .container {
            width: 1080px;
            margin: 0 auto;
        }

        .container ul {
            overflow: hidden;
            clear: both;
        }

        .container ul li {
            position: relative;
            float: left;
            list-style: none;
            background-color: #fff;
            margin: 10px 9px 0 0;
            width: 260px;
            height: 375px;
        }

        .container ul li:nth-child(4n) {
            margin-right: 0;
        }

        .container ul li a {
            display: block;
            width: 100%;
            height: 100%;
            text-align: center;
            text-decoration: none;
            padding-top: 20px;
        }

        img {
            width: 250px;
            height: 230px;

        }

        .container ul li a .text {
            width: 100%;
            margin-top: 20px;
        }

        .text .name {
            display: block;
            color: #333;
            font-size: 16px;
            margin-bottom: 3px;
        }

        .text .desc {
            display: block;
            color: #999;
            font-size: 15px;
        }

        .text .price i {
            font-style: normal;
            font-size: 17px;
            color: red;
        }

        .text .price {
            display: inline-block;
            color: red;
            font-size: 22px;
            /* padding-left: 14px; */
        }

        .text .price em {
            font-size: 16px;
            font-style: normal;
        }

        .prodect-sign {
            position: absolute;
            top: 15px;
            left: 20px;
            display: block;
            width: 55px;
            height: 55px;
            background-color: pink;
            border-radius: 60%;
            line-height: 55px;
            color: #fff;
            font-size: 16px;
        }
    </style>
</head>

<body>
    <div class="container">
        <ul>
            <li>
                <a href="#">
                    <img src="./img/1.webp" alt="">
                    <div class="text">
                        <span class="name">小米 11Pro</span>
                        <span class="desc">限时优惠,抢购吧</span>
                        <span class="price"><i>¥</i>1999<em>起</em></span>
                    </div>
                    <span class="prodect-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./img/2.png" alt="">
                    <div class="text">
                        <span class="name">小米 12Pro</span>
                        <span class="desc">限时优惠,抢购吧</span>
                        <span class="price"><i>¥</i>2999<em>起</em></span>
                    </div>
                    <span class="prodect-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./img/1.webp" alt="">
                    <div class="text">
                        <span class="name">小米 11U</span>
                        <span class="desc">限时优惠,抢购吧</span>
                        <span class="price"><i>¥</i>2222<em>起</em></span>
                    </div>
                    <span class="prodect-sign">免息</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="./img/2.png" alt="">
                    <div class="text">
                        <span class="name">小米 12U</span>
                        <span class="desc">限时优惠,抢购吧</span>
                        <span class="price"><i>¥</i>3333<em>起</em></span>
                    </div>
                    <span class="prodect-sign">免息</span>
                </a>
            </li>
        </ul>
    </div>
</body>

偷懒用老师写的尺寸,但是看着好大啊,对于类名还是不会起名字,不会管理

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 109楼

0c5d58829814f438a9967557a226f07.png

为什么这里要用h3?用p的效果也是一样的


WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 110楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 113楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/初识CSS 115楼

一、老师,这是这个周的是操作业,我遇到的问题是 middle2 达不到作业的要求,没有紧贴盒子底部
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box1{
            width: 100%
            height: 50px;
            background-color: blue;
        }
        .wrap{
            width: 700px;
            height: 50px;
            margin: 0 auto;
            background-color: cadetblue;
            padding-top: 10px;
        }
        .box2{
            width: 700px;
            height: 100px;
            background-color: cadetblue;
            margin: 10px auto 0px auto;
            padding-top: 20px;
        }
        .box3{
            width: 700px;
            height: 20px;
            background-color: gray;
            margin: 0 auto;
        }
        .box4{
            width: 700px;
            height: 40px;
            background-color: green;
            margin: 0 auto;
            padding-top: 50px;

        }
        .box5{
            width: 700px;
            height: 250px;
            background-color: gray;
            margin: 0 auto;
            margin-top-40px;

        }
        .box6{
            width: 700px;
            height: 20px;
            background-color: dodgerblue;
            margin: 10px auto 0px auto;
        }
        .no1{
            padding-left: 50%;
            padding-right: 50%;
        }
        .no2{
            padding-left: 50%;
            padding-right: 50%;
        }
        .no3{
            padding-left: 50%;
            padding-right: 50%;
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="wrap"><span class="no1">top1</span></div>
    </div>

    <div class="box2" ><span class="no2">middle1</span></div>
    <div class="box3"></div>
    <div class="box4" ><span class="no3">middle2</span></div>
    <div class="box5"></div>
    <div class="box6"></div>
</body>
</html>


image.png



WEB前端全系列/第一阶段:HTML5+CSS3模块/初识CSS 116楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 117楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 118楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 119楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 120楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637