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

小米.rar

老师为什么在搜索框哪里我鼠标聚焦的时候,边框颜色不会变成橘色呢

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小米</title>
    <link rel="icon" href="小米images/favicon.ico">
    <link rel="stylesheet" href="CSS/reset.css">
    <link rel="stylesheet" href="CSS/mi.css">
</head>
<body>
<!--头部开始-->
<div class="header">
    <a href="#">
        <img src="小米images/a2a9e6db5e3c5374301827435d8595c6.jpg" alt="">
    </a>
</div>
<!--头部结束-->
<!--黑色导航部分开始-->
<div class="black-nav">
    <div class="black-nav-left">
        <ul>
            <li>
                <a href="#">小米商城</a>
            </li>
            <li>
                <a href="#">MIUI</a>
            </li>
            <li>
                <a href="#">loT</a>
            </li>
            <li>
                <a href="#">云服务</a>
            </li>
            <li>
                <a href="#">天星数科</a>
            </li>
            <li>
                <a href="#">有品</a>
            </li>
            <li>
                <a href="#">小爱开发平台</a>
            </li>
            <li>
                <a href="#">企业团购</a>
            </li>
            <li>
                <a href="#">资质证照</a>
            </li>
            <li>
                <a href="#">协议规则</a>
            </li>
            <li>
                <a href="#">下载app</a>
            </li>
            <li>
                <a href="#">智能生活</a>
            </li>
            <li>
                <a href="#">select Location</a>
            </li>
        </ul>
    </div>
    <div class="black-nav-right">
        <ul>
            <li><a href="#">登录</a></li>
            <li><a href="#">注册</a></li>
            <li><a href="#">消息通知</a></li>
            <li><a href="#">
                <img src="小米images/692a6c3b0a93a24f74a29c0f9d68ec71.png" alt="">购物车</a>
                <div class="cart-list">
                </div>
            </li>
        </ul>
    </div>
</div>
<!--黑色导航部分结束-->
</body>
</html>
/*头部样式开始*/
.header{
    width: 100%;
    height: 120px;
    background: red;
    overflow: hidden;
    position: relative;
}
.header img{
    height: 120px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
/*头部样式结束*/
/*黑色导航开始*/
.black-nav{
    width: 100%;
    height: 40px;
    background:#b0b0b0;
}
.black-nav-left{
    margin-left: 100px;
    width: 789px;
}
.black-nav-right{
    margin-left: 100px;
    height: 40px;
    position: relative;
}
.black-nav-left a,.black-nav-right a{
    color: white;
    float: left;
    font-size: 12px;
    padding: 3px;
    line-height: 40px;
}
.black-nav-right img {
    height: 40px;
}
a:hover{
    color: deepskyblue;
}
.cart-list{
    width: 316px;
    height: 78px;
    background: deeppink;
    position: absolute;
    top: 40px;
    left:660px;
    display: none;
}
.black-nav-right li:hover>.cart-list{
    display: block;
}
/*黑色导航结束*/

现在我的鼠标放到第一个列表上的时候,为什么字体颜色不变成蓝色了呢

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小米</title>
    <link rel="icon" href="小米images/favicon.ico">
    <link rel="stylesheet" href="CSS/reset.css">
    <link rel="stylesheet" href="CSS/mi.css">
</head>
<body>
<!--头部开始-->
<div class="header">
    <a href="#">
        <img src="小米images/a2a9e6db5e3c5374301827435d8595c6.jpg" alt="">
    </a>
</div>
<!--头部结束-->
<!--黑色导航部分开始-->
<div class="black-nav">
    <div class="black-nav-left">
        <ul>
            <li>
                <a href="#">小米商城</a>
            </li>
            <li>
                <a href="#">MIUI</a>
            </li>
            <li>
                <a href="#">loT</a>
            </li>
            <li>
                <a href="#">云服务</a>
            </li>
            <li>
                <a href="#">天星数科</a>
            </li>
            <li>
                <a href="#">有品</a>
            </li>
            <li>
                <a href="#">小爱开发平台</a>
            </li>
            <li>
                <a href="#">企业团购</a>
            </li>
            <li>
                <a href="#">资质证照</a>
            </li>
            <li>
                <a href="#">协议规则</a>
            </li>
            <li>
                <a href="#">下载app</a>
            </li>
            <li>
                <a href="#">智能生活</a>
            </li>
            <li>
                <a href="#">select Location</a>
            </li>
        </ul>
    </div>
    <div class="black-nav-right">
        <ul>
            <li><a href="#">登录</a></li>
            <li><a href="#">注册</a></li>
            <li><a href="#">消息通知</a></li>
            <li><a href="#">
                <img src="小米images/692a6c3b0a93a24f74a29c0f9d68ec71.png" alt="">购物车</a></li>
        </ul>
    </div>

</div>
<!--黑色导航部分结束-->
</body>
</html>
/*头部样式开始*/
.header{
    width: 100%;
    height: 120px;
    background: red;
    overflow: hidden;
    position: relative;
}
.header img{
    height: 120px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
/*头部样式结束*/
/*黑色导航开始*/
.black-nav{
    width: 100%;
    height: 40px;
    background:#b0b0b0;
}
.black-nav-left{
    margin-left: 100px;
    width: 789px;
}
.black-nav-right{
    margin-left: 100px;
    height: 40px;
}
.black-nav-left a,.black-nav-right a{
    color: white;
    float: left;
    font-size: 12px;
    padding: 3px;
    line-height: 40px;
}
.black-nav-right img {
    height: 40px;
}
a:hover{
    color: deepskyblue;
}
/*黑色导航结束*/

为什么我在购物车前面加了图片,购物车三个字就不能垂直居中了

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小米</title>
    <link rel="icon" href="小米images/favicon.ico">
    <link rel="stylesheet" href="CSS/reset.css">
    <link rel="stylesheet" href="CSS/mi.css">
</head>
<body>
<!--头部开始-->
<div class="header">
    <a href="#">
        <img src="小米images/a2a9e6db5e3c5374301827435d8595c6.jpg" alt="">
    </a>
</div>
<!--头部结束-->
<!--黑色导航部分开始-->
<div class="black-nav">
    <div class="black-nav-left">
        <ul>
            <li>
                <a href="#">小米商城</a>
            </li>
            <li>
                <a href="#">MIUI</a>
            </li>
            <li>
                <a href="#">loT</a>
            </li>
            <li>
                <a href="#">云服务</a>
            </li>
            <li>
                <a href="#">天星数科</a>
            </li>
            <li>
                <a href="#">有品</a>
            </li>
            <li>
                <a href="#">小爱开发平台</a>
            </li>
            <li>
                <a href="#">企业团购</a>
            </li>
            <li>
                <a href="#">资质证照</a>
            </li>
            <li>
                <a href="#">协议规则</a>
            </li>
            <li>
                <a href="#">下载app</a>
            </li>
            <li>
                <a href="#">智能生活</a>
            </li>
            <li>
                <a href="#">select Location</a>
            </li>
        </ul>
    </div>
    <div class="black-nav-right">
        <ul>
            <li><a href="#">登录</a></li>
            <li><a href="#">注册</a></li>
            <li><a href="#">消息通知</a></li>
            <li><a href="#">购物车</a></li>
        </ul>
    </div>

</div>
<!--黑色导航部分结束-->
</body>
</html>
/*头部样式开始*/
.header{
    width: 100%;
    height: 120px;
    background: red;
    overflow: hidden;
    position: relative;
}
.header img{
    height: 120px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
/*头部样式结束*/
/*黑色导航开始*/
.black-nav{
    width: 100%;
    height: 40px;
    background:#b0b0b0;
}
.black-nav-left{
    margin-left: 100px;
    width: 789px;
}
.black-nav-right{
    margin-left: 100px;
}
.black-nav-left a,.black-nav-right a{
    color: white;
    float: left;
    font-size: 12px;
    padding: 3px;
    line-height: 40px;
}
/*黑色导航结束*/
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, legend, input, textarea, button, p, blockquote, th, td
{margin: 0;padding: 0;}
body{text-align: center;font-family: Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif;}
li{ list-style: none;}
a{text-decoration: none;}
img{border: none;}

为什么注册登录哪里设置了margin-left但是没有生效呢

image.png

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
    <style>
        *{
            margin: 0;
        }
        .box{
            width: 1263px;
            height: 750px;
            /*background: red;*/
        }
        .wrap{
            width: 25%;
            height: 375px;
            /*background: blue;*/
            float: left;
            padding: 10px;
            box-sizing: border-box;
            position: relative;
        }
        .items>img{
            width: 100%;
            height: 100%;
        }
        .items-name{
            position: absolute;
            top: 265px;
            left:25px;
        }
        .items-name1{
            left:90px;
        }
        .items-information{
            position: absolute;
            top: 300px;
            left:40px;
        }
        .items-information1{
            left:25px;
        }
        .items-price{
            position: absolute;
            top: 310px;
            left:100px;
        }
        .box-p{
            width: 303px;
            height: 80px;
        }
        .box-p>p:first-of-type{
            color: #333333;
            font-size: 16px;
            margin-top: 1px;
        }
        .box-p>p:nth-child(2){
            font-size: 14px;
            color: #999999;
        }
        .box-p>p:last-of-type{
            font-size: 22px;
            color: #cc0000;
        }
        span{
            color: #999999;
            font-size: 12px;
        }
        .items:hover{
            box-shadow: 0 10px 10px rgba(0,0,0,.18);
            /*transform: scale(1.1);*/
        }
        .circle{
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(to bottom right,hotpink,pink);
            position: absolute;
            top: 20px;
            left: 20px;
            line-height: 50px;
        }
    /*    移动端*/
        @media screen and (max-width: 768px) {
            .wrap{
                width: 50%;
            }
        }
    /*    Ipad端*/
        @media screen and(max-width: 992px) and (min-width: 768px){
            .wrap{
                width: 33%;
            }
        }
    /*    pc端*/
        @media screen and (min-width: 992px){
            .wrap{
                width: 25%;
            }
        }
    </style>
</head>
<body>
 <div class="box">
     <div class="wrap">
         <div class="items">
             <img src="魅族images/be6fed05-168e-4633-bc1d-6e75705fce07.jpg" alt="">
             <p class="items-name" style="font-size: 21px;font-weight: 700;color: #ffffff">魅族 HD60 头戴式蓝牙耳机</p>
             <p class="items-information" style="color: #ffffff;font-size: 14px">40mm生物振膜 | 触控操作 | 蓝牙5.0</p>
             <p class="items-price" style="font-size: 24px;font-weight: 700;color:gold">¥499</p>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/08/5E/Cgbj0V_38NOAGvEXAAN6WGRLi3Y197.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 POP Pro 主动降噪耳机</p>
                 <p>【限时特惠449元+3期免息】</p>
                 <p>¥449 <span><small><del>¥499</del></small></span></p>
             </div>
         </div>
         <div class="circle" style="color: white;text-align: center">
         <p>免息</p>
     </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/08/40/Cgbj0V-JCMSAa5qBAAMth2Y6_gU978.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 POP2s 真无线耳机</p>
                 <p>【限时特惠199元+3期免息】</p>
                 <p>¥199 <span><small><del>¥299</del></small></span></p>
             </div>
         </div>
         <div class="circle" style="color: white;text-align: center">
             <p>免息</p>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/07/2F/Cgbj0Vy_C3GAN_TKAAExaPfTwFc180.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 HIFI 解码耳放</p>
                 <p>【限时特惠149元】</p>
                 <p>¥149 <span><small><del>¥169</del></small></span></p>
             </div>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://fms.res.meizu.com/dms/2019/08/29/04811a8d-07fb-4188-a852-1971f442d08f.jpg" alt="">
             <p class="items-name items-name1" style="font-size: 21px;font-weight: 700;color: #ffffff">魅族 EP3C 耳机</p>
             <p class="items-information items-information1" style="color: #ffffff;font-size: 14px">Hi-Res 认证高解析音质 | Type-C数字接口</p>
             <p class="items-price" style="font-size: 24px;font-weight: 700;color:gold">¥
                 129</p>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/07/E0/Cgbj0V6z8VSAV6kEAAlCc-omYno614.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 HD60 降噪耳机</p>
                 <p>【限时特惠799元+12期免息】</p>
                 <p>¥799 <span><small><del>¥1099</del></small></span></p>
             </div>
         </div>
         <div class="circle" style="color: white;text-align: center">
             <p>免息</p>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/07/86/Cgbj0V3UocyAR_tJAApbDmCAyEo620.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 HD60 头戴式蓝牙耳机</p>
                 <p>40mm生物振膜 | 触控操作 | 蓝牙5.0</p>
                 <p>¥449</p>
             </div>
         </div>
     </div>
     <div class="wrap">
         <div class="items">
             <img src="https://openfile.meizu.com/group1/M00/04/17/Cgbj0VrcX6yABHxPAARZwWUAjc4748.png" alt="">
             <div class="box-p" align="center">
                 <p>魅族 HALO 激光蓝牙耳机</p>
                 <p>炫酷夜跑神器 随性张扬</p>
                 <p>¥449 <span><small><del>¥999</del></small></span></p>
             </div>
         </div>
     </div>
 </div>
</body>
</html>

我为什么缩小到移动端的时候,图片并没有变小,感觉所有的格式都乱了呢,还有就是并没有按相应该显示的几个

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS盒子模型 430楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>魅族</title>
    <style>
        .box-header{
            width: 100%;
            height: 680px;
            background: url("魅族images/444c6b0f-a71c-4e91-8c17-6745223228c5.jpg") no-repeat center ;
            background-size: cover;
        }
        .box-phone{
            width: 100%;
            height: 450px;
            background: url("魅族images/a6c64f8f-6ab5-4a93-8139-2a893eb2a2a5.jpg") no-repeat center;
            background-size: cover;
        }
        .box-header-bottom{
            width: 1262px;
            height: 277px;
            /*background: red;*/
        }
        .box-top{
            width: 25%;
            height: 100%;
            /*background: orange;*/
            float: left;
        }
        .img1{
            width: 130px;
            height: 130px;
        }
        .box-top>p:first-of-type,.phone-top-left>p:first-of-type,.phone-top-right>p:first-of-type,.phone-bottom-items>p:first-of-type{
            font-size: 20px;
            font-weight: bold;
            width: 310px;
            height: 30px;
        }
        .box-top>p:last-child,.phone-top-left>p:first-of-type+p,.phone-top-right>p:first-of-type+p,.phone-bottom-items>p:last-of-type{
            color: #999999;
            font-size: 14px;
            width: 310px;
            height: 21px;
        }
        .title{
            text-align: center;
            font-weight: bold;
            font-size: 2em;
        }
        .box-phone-bottom{
            width: 1262px;
            height: 1005px;
        }
        .box-phone-bottom-center{
            width: 1230px;
            height:1220px;
        }
        .phone-top{
            width:1230px;
            height: 610px;
        }
        .phone-bottom{
            width: 1212px;
            height: 375px;
        }
        .phone-top-left,.phone-top-right{
            width: 615px;
            height: 610px;
            float: left;
        }
        .phone-bottom-items{
            width: 303px;
            height: 375px;
            float: left;
        }
        .img2{
            width: 460px;
            height: 460px;
        }
        .price{
            width: 71px;
            height: 33px;
            color: red;
            font-size: 28px;
        }
        .price1{
            width: 14px;
            height: 21px;
            font-size: 12px
        }
        .img3{
         width: 230px;
            height: 230px;
        }
/*.img+p{
    font-size: 20px;
    font-weight: bold;
}*/
    </style>
</head>
<body>
<div class="box-header">
    <a href="https://www.meizu.com/">
    </a>
</div>
<div class="box-header-bottom">
    <div class="box-top" align="center">
        <img src="魅族images/5f896683-d2f2-487d-a296-722fc9e17f1e.png" alt="" class="img1">
        <p>魅族 18</p>
        <p>立省900 + 12 期免息 + 赠手机壳</p>
    </div>
    <div class="box-top" align="center">
        <img src="魅族images/5f896683-d2f2-487d-a296-722fc9e17f1e.png" alt="" class="img1">
        <p>魅族 18</p>
        <p>立省900 + 12 期免息 + 赠手机壳</p>
    </div>
    <div class="box-top" align="center">
        <img src="魅族images/5f896683-d2f2-487d-a296-722fc9e17f1e.png" alt="" class="img1">
        <p>魅族 18</p>
        <p>立省900 + 12 期免息 + 赠手机壳</p>
    </div>
    <div class="box-top" align="center">
        <img src="魅族images/5f896683-d2f2-487d-a296-722fc9e17f1e.png" alt="" class="img1">
        <p>魅族 18</p>
        <p>立省900 + 12 期免息 + 赠手机壳</p>
    </div>
</div>
<h3 class="title">手机</h3>
<div class="box-phone">
</div>
<div class="box-phone-bottom">
    <div class="box-phone-bottom-center">
        <div class="phone-top" >
            <div class="phone-top-left" align="center">
                <p>魅族 18</p>
                <p>限时领券至高立省900 | 赠手机壳</p>
                <p class="price"><span class="price1">¥</span>3999</p>
                <img src="魅族images/de87d38d-3785-4605-a211-71364ded123f.png" alt=""  class="img2">
            </div>
            <div class="phone-top-right" align="center">
                <p>魅族 18</p>
                <p>限时领券至高立省900 | 赠手机壳</p>
                <p class="price"><span class="price1">¥</span>3999</p>
                <img src="魅族images/de87d38d-3785-4605-a211-71364ded123f.png" alt=""  class="img2">
            </div>
        </div>
        <div class="phone-bottom">
            <div class="phone-bottom-items" align="center">
                <img src="魅族images/Cgbj0F6zwMuANEeWAAw6yQFAJXM097.png" alt="" class="img3">
                <p>魅族 17「AG梦幻独角兽」</p>
                <p>高通骁龙 865 | 120 Hz尝鲜模式</p>
                <p class="price"><span class="price1">¥</span> 3699</p>
            </div>
            <div class="phone-bottom-items" align="center">
                <img src="魅族images/Cgbj0F6zwMuANEeWAAw6yQFAJXM097.png" alt="" class="img3">
                <p>魅族 17「AG梦幻独角兽」</p>
                <p>高通骁龙 865 | 120 Hz尝鲜模式</p>
                <p class="price"><span class="price1">¥</span>3699</p>
            </div>
            <div class="phone-bottom-items" align="center">
                <img src="魅族images/Cgbj0F6zwMuANEeWAAw6yQFAJXM097.png" alt="" class="img3">
                <p>魅族 17「AG梦幻独角兽」</p>
                <p>高通骁龙 865 | 120 Hz尝鲜模式</p>
                <p class="price"><span class="price1">¥</span> 3699</p>
            </div>
            <div class="phone-bottom-items" align="center">
                <img src="魅族images/Cgbj0F6zwMuANEeWAAw6yQFAJXM097.png" alt="" class="img3">
                <p>魅族 17「AG梦幻独角兽」</p>
                <p>高通骁龙 865 | 120 Hz尝鲜模式</p>
                <p class="price"><span class="price1">¥</span> 3699</p>
            </div>
        </div>
    </div>
</div>
</body>
</html>

老师,我写魅族官网写了一部分,为什么价格哪里class都一样,但是设置不出来同样的样式呢?

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS常用属性 431楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 434楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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