会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133730个问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css1/reset.css">
    <style>
        .box{
            box-sizing: border-box;
            width: 234px;
            height: 320px;
            padding: 20px 0;
            position: relative;
            text-align: center;
            background-color: coral;
            margin: 10px;
        }
        .box img{
            width: 80px;
            height: 160px;
            position: absolute;
            top: 21px;
            left: 77px;


        }
        .box>img:first-child{
            z-index: 10;
        }
        .box2{
            position: absolute;
            top:204px;
            background-color: yellow;
            width: 100%;
            height: 102px;
            text-align: center;
        }
        p{margin-bottom: 1px ;
      }
      .box2>p:last-child{
          margin-top: 10px;
      }

      .box:hover>img:first-child{
          left:40px
      }
      .box:hover>img:last-child{
       left:114px
      }
    </style>
</head>
<body>
   
<div class="box">
    <img src="images/position练习3.jpg" alt="">
    <img src="images/22.jpg" alt="" class="i2">
       <div class="box2">
          <p>黑鲨4S</p>
          <p>磁动力升降肩键</p>
          <p>2699元起</p>

    </div>
</div>
</body>
</html>

老师为啥用这个 last-child选择器不生效  用类选择器.i2就会生效?  要有三个img才可以使用last-child嘛?

.box:hover>img:last-child{
       left:114px
      }


WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS常用属性 421楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 423楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 424楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   
   <table  wdith='500px' height='400' border="1">
       <caption>单元格的属性</caption>
       <tr>
           <td>111111111111</td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
       </tr>
       <tr>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
       </tr>
       <tr>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
       </tr>
       <tr>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
       </tr>
       <tr>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
       </tr>
   </table>
</body>
</html>

老师 为啥我没有内容  单元格撑不开?  我看22分视频可以撑开的

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 427楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 429楼

HTML:
<!-- 79-小米.html     -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小米</title>
    <link rel="stylesheet" href=".\css\reset.css">
    <link rel="icon" href=".\images\favicon.ico">
    <link rel="stylesheet" href=".\css\mi.css">

</head>

<body>
    <!-- 头部开始 -->
    <div class="header">
        <a href="#"><img src=".\images\a2a9e6db5e3c5374301827435d8595c6.jpg" alt="照片无法显示"></a>
    </div>
    <!-- 头部结束 -->
    <!-- 黑色导航条 -->
    <div class="nav">
        <div class="wrap">
            <div class='left'>
                <ul>
                    <li><a href="#">小米商城</a><span>|</span></li>
                    <li><a href="#">MIUI</a><span>|</span></li>
                    <li><a href="#">IOT</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li class='download'><a href="#">下载App</a><span>|</span>
                        <div class="triangle"></div>
                        <div class='download-QRcode'>
                            <img src="./images/download.png" alt="无法显示">
                            <p>小米商城APP</p>
                        </div>
                    </li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                    <li><a href="#">智能手机</a><span>|</span></li>
                </ul>
            </div>
            <div class="right">
                <div class='user-info'>
                    <ul>
                        <li><a href="">登录</a></li>
                        <li><a href="">注册</a></li>
                        <li class='message'><a href="#">消息通知</a></li>

                    </ul>
                </div>
                <div class='shop-cart'>
                    <p><img src="" alt=""><span>购物车</span></p>
                    <div class='triangle'></div>
                    <div class="cart-list"></div>

                </div>
            </div>

        </div>

    </div>

</body>

</html>

CSS

body{
    background-color: blueviolet;
}
.header{
    width: 100%;
    height: 120px;
    /* overflow: hidden; */
    /* position: relative; */

}
.header img{
    height: 120px;
    margin: 0 auto;
    /* position: absolute;
    left: 50%;
    transform: translate(-50%);  */
}
.nav{
    width: 100%;
    height: 40px;
    background-color: #333333;
}
.wrap{
    height: 40px;
    width: 1226px;
    margin: 0 auto;
    /* background-color: pink; */
}
.wrap .left{
    /* width: 900px; */
    height: 40px;
    line-height: 40px;
    float: left;
    /* background-color: orange; */
}

.wrap .left>ul>li{
    /* width: 69px; */
    /* padding:0 5px; */
    float: left;
    
    box-sizing: border-box;
    text-align: center;
}
.wrap .left>ul>li>a{
    font-size: 12px;
    color: #a4a484;
}
.wrap .left>ul>li:hover>a{
    color: white;
}
.wrap .left span{
    margin: 0 3.6px;
}
.wrap .right{
    float: right;
    display: flex;
    justify-content: space-around;
}
.wrap .right .user-info{
    width:137px;
    height: 40px;
    line-height: 40px;
    margin: 0 5px;
    float: left;
    /* background-color: yellow; */
}
.wrap .user-info .message{
    margin: 0 10px;
}
/* .wrap .user-info>ul>li{
    /* float: left; */
/* .wrap .user-info>ul{
    justify-content:space-around ;
    display: flex;
} */
.user-info ul{
    display: flex;
    justify-content: space-between;
}
.wrap .user-info>ul>li>a{
   font-size: 12px;
   color: #a4a484;
   

}
.wrap .shop-cart{
    float: right;
    width: 120px;
    height: 40px;
    line-height: 40px;
    background-color:paleturquoise;
    position: relative;

}
.wrap .shop-cart:hover{
    background-color: white;
}
.wrap .shop-cart p{
    font-size: 12px;
    color: #a4a484;
}
.wrap .shop-cart .cart-list{
    width: 316px;
    height: 100px;
    background-color: white;
    position: absolute;
    bottom: -100px;
    left: -196px;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.wrap .shop-cart:hover>p{
    color: orange;
}
.wrap .shop-cart:hover .cart-list{
    display: block;

}
.download{
    
    /* width: 124px; */
    position: relative;
    transition: all .3s;
}
.download:hover>.download-QRcode{

    display: block;
}

.download:hover>.triangle{
    display: block;
}
.download .triangle{
    width: 0;
    height: 0;
    border-bottom: 8px solid white;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    position: absolute;
    bottom: 0;
    left: 42%;
    transform: translate(-8px);
    display: none;
    /* z-index: 999; */
}
.download .download-QRcode{
    width: 124px;
    height: 148px;
    position: absolute;
    top: 40px ;
    left: 50%;
    transform: translate(-62px);
    background-color: white;
    text-align: center;
    display: none;
    /* transition: all 10s; */
}
.download .download-QRcode img{
    width: 90px;
    margin: 18px 0 12px;
}
.download .download-QRcode p{
    position: relative;
    bottom: 26px;
    font-size: 14px;
}

老师我那个transition设置了all 0.3s为什么没有反应?

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 430楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 432楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/浮动与定位 433楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS选择器 435楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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