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

<!--主体开始-->
<div class="cantent">
    <div class="wrap">
        <!--手机开始-->
        <div class="phone">
            <h3 class="title">手机</h3>
            <div class="phone-box">
                <div class="phone-box-left">
                    <a href="#">
                        <img src="image/cb1bd61ad71c45a4f67f09b075463944.jpeg" alt=""/>
                    </a>
                </div>
                <div class="phone-box-right">
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                    <div class="items1">
                        <a href="#">
                            <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b3553083a4975325eab6470d94465548.jpg?thumb=1&w=120&h=120" alt=""/>
                            <p class="name2">小米10s</p>
                            <p class="name3">骁龙870 | 对称式双扬立体声</p>
                            <p class="name4">3299元起</p>
                        </a>
                    </div>
                </div>
            </div>
            <div class="big-img">
                <a href="#">
                    <img src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/41d16e66381cfeda7b6b39ab67678d5e.jpg?thumb=1&w=736&h=72" alt=""/>
                </a>
            </div>
        </div>
        <!--手机结束-->
    </div>
</div>
<!--主体结束-->


css
/*主体开始*/
.cantent{
    width: 100%;
    /*自动找高*/
    overflow: hidden;
    padding: 4px 0 12px;
    background-color: #f5f5f5;
}
.title{
    text-align: left;
    color: #333;
    font-size: 22px;
    font-weight: 200;
    line-height: 58px;
}
.phone-box{
    width: 100%;
    height: 614px;
}
.phone-box-left{
    width: 234px;
    height: 614px;
    float: left;
    transition: all .2s linear;
    box-sizing: border-box;
}
.phone-box-right{
    width: 992px;
    height: 614px;
    /*background-color: deepskyblue;*/
    float: left;


}
.phone-box-left img{
    width: 100%;
    height: 100%;
}
.items1{
    width: 234px;
    height: 282px;
    padding: 20px 0;
    margin: 0 0 14px 14px;
    background-color: #fff;
    float: left;
    transition: all .2s linear;
    /*box-sizing: border-box;*/
}
.items1 img{
    width: 160px;
    height: 160px;
    margin-bottom: 18px; ;
}
.name2{
    width: 214px;
    height: 20px;
    color: #333;
    font-size: 14px;
    line-height: 21px;
    margin: 0 10px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.name3{
    width: 214px;
    height: 18px;
    font-size: 12px;
    color: #b0b0b0;
    margin: 0 10px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.name4{
    width: 214px;
    height: 21px;
    color: #ff6700;
    margin: 0 10px 14px;
    font-size: 14px;
}
.phone-box-left:hover{
    box-shadow: 0 15px 30px rgba(0,0,0,.1);
    transform: translate(0,-2px);
}
.items1:hover{
    box-shadow: 0 15px 30px rgba(0,0,0,.1);
    transform: translate(0,-2px);
}
.big-img{
    width: 100%;
    height: 120px;

 }
.big-img img{
    width: 1226px;
    height: 120px;
    margin: 22px 0;
}

老师 我已经遇见过好几次这种情况了,代码没问题,但就是不显示,去浏览器检索了也有,但就是显示不出来,空白一片,这到底是bug?还是什么问题,求老师解答下!!感谢

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

<!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">
    <link rel="stylesheet" href="./icon/iconfont.css">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #box{
            width:600px;
            height:1200px;
            margin:auto;
            background:rgb(14, 112, 128);
        }
        #box > h2{
            padding:50px;
            padding-bottom:15px;
            text-align:center;
            color:white;
        }
        #box > h2:nth-child(2){
            padding-top:0px;
            color:yellow;
        }
        #box > h3{
            height:40px;
            text-align:center;
            line-height:40px;
            color:white;
            border:1px solid red;
        }
        #box > h3 > i{
            font-size:30px;
            color:white;
        }
        #box > .content{
            width:100%;
            height:280px;
            margin-top:20px;
        }
        #box > .content .content_center{
            width:75%;
            height:100%;
            margin:auto;
        }
        #box > .content .content_center .content_center_left{
            float:left;
            width:60%;
            height:100%;
        }
        #box > .content .content_center .content_center_left .content_center_left_top{
            width:100%;
            height:60px;
            text-align:center;
            color:white;
            line-height:60px;
            font-size:20px;
        }
        #box > .content .content_center .content_center_left .content_center_left_bottom{
            width:220px;
            height:220px;
            margin:auto;
            background:pink;
        }
        #box > .content .content_center .content_center_right{
            float:left;
            width:40%;
            height:100%;
        }
        #box > .content .content_center .content_center_right .content_center_right_center{
            float:right;
            width:80%;
            height:100%;
            padding-top:8px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .content_center_right_center_top{
            width:100%;
            height:120px;
        }   
        #box > .content .content_center .content_center_right .content_center_right_center .fz{
            width:100%;
            height:40%;
            font-size:20px;
            color:white;
            line-height:48px;
            text-align:center;
            cursor: pointer;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .lj{
            width:100%;
            height:46%;
            text-align:center;
            line-height:55px;
            border-radius:30px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .fzje{
            background:yellow;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .fzlj{
            background:white;
            margin-top:0px;
        }
        #box > .content .content_center .content_center_right .content_center_right_center .content_center_right_center_bottom{
            width:100%;
            height:120px;
            margin-top:50px;
        }
        #box > .ziduan{
            width:100%;
            margin-top:40px;
            color:white;
        }
        #box > .ziduan > p{
            margin-left:20px;
            line-height:40px;
        }
    </style>
</head>
<body>

    <div id="box">
        <h2>请使用USDT-TRC20支付转账</h2>
        <h2>转账数量需严格要求, 数量错误将不会到账</h2>
        <h3> <i class="iconfont icon-naozhong"></i> 有效时间 : <span class="shi">10</span>:<span class="fen">00</span>:<span class="miao">00</span></h3>
        <div class="content">
            <div class="content_center">
                <div class="content_center_left">
                    <div class="content_center_left_top">
                        马上扫码去转账
                    </div>
                    <div class="content_center_left_bottom"></div>
                </div>
                <div class="content_center_right">
                    <div class="content_center_right_center">
                        <div class="content_center_right_center_top">
                            <div class="fz">复制金额</div>
                            <div class="lj fzje">15.38 USDT</div>
                        </div>
                        <div class="content_center_right_center_bottom">
                            <div class="fz">复制链接</div>
                            <div class="lj fzlj">链接</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ziduan">
            <p>温馨提醒</p>
            <p>1. 请勿向上述地址充值任何非USDT-TRC20资产, 否则资产将不可找回</p>
            <p>2. 您充值至上述地址后, 需整个网络节点的确认, 多次网络确认后到账</p>
            <p>3. 务必确保最终到账金额为15.38USDT, 不包含额外手续费, 其他不符金额都不自动到账</p>
            <p>4. 该地址只能使用一次, 重复使用会造成资产丢失</p>
        </div>
    </div>
    
</body>
</html>


WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 557楼

老师,我想请教一下当鼠标悬停在白色导航上照理说出现的下拉导航里的样式应该是一致的,但是为什么我换了其他图片之后它的布局就完全改变了(布局是统一设计的,只是换了不同的图片想去验证一下);我也下载了源代码直接在源代码相应部分也试着换了其他图片,发现结果都是一样的,布局会紊乱。

<!--白色导航部分-->
    <div class="white-nav">
        <div class="wrap">
            <div class="logo">
                <img class="mi-home" src="images/mi-home.png" alt="">
                <img class="mi-logo" src="images/mi-logo.png" alt="">
            </div>
            <div class="nav-bar">
                <ul>
                    <li>
                        <a href="#">
                            <img src="images/f58837161090e2e04bf687088b2ffe77.gif" alt="">
                        </a>
                    </li>
                    <li>
                        <a href="#">小米手机</a>
                        <div class="nav-bar-list">
                            <div class="wrap">
                                <ul>
                                    <li>
                                        <a href="#">
                                            <div class="img-box">
                                                <img src="images/8729282b199b3ec51e31c1b6b15f3f93.jpg" alt="">
                                            </div>
                                            <p class="name1">小米10至尊纪念版</p>
                                            <p class="price1">5299元起</p>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <div class="img-box">
                                                <img src="images/b11742a0be47f9d97bb6a13ea580018d.png" alt="">
                                            </div>
                                            <p class="name1">小米11</p>
                                            <p class="price1">3999元起</p>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <div class="img-box">
                                                <img src="images/b11742a0be47f9d97bb6a13ea580018d.png" alt="">
                                            </div>
                                            <p class="name1">小米10至尊纪念版</p>
                                            <p class="price1">5299元起</p>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <div class="img-box">
                                                <img src="images/b11742a0be47f9d97bb6a13ea580018d.png" alt="">
                                            </div>
                                            <p class="name1">小米10至尊纪念版</p>
                                            <p class="price1">5299元起</p>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </li>
                    <li>
                        <a href="#">Redmi 红米</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>
                </ul>
            </div>
            <div class="search"></div>
        </div>
    </div>
/*白色导航部分*/

.white-nav {
    width: 100%;
    height: 100px;
    position: relative;
}

.logo {
    width: 55px;
    height: 55px;
    background-color: #ff6700;
    float: left;
    margin-top: 22.5px;
    position: relative;
    overflow: hidden;
}

.logo>img {
    width: 100%;
    height: 100%;
    position: absolute;
    transition: all .2s;
}

.mi-home {
    left: -55px;
}

.mi-logo {
    left: 0;
}

.logo:hover>.mi-home {
    left: 0;
}

.logo:hover>.mi-logo {
    left: 55px;
}

.nav-bar {
    width: 875px;
    height: 100px;
    float: left;
    line-height: 100px;
}

.nav-bar>ul>li {
    float: left;
}

.nav-bar>ul>li>a {
    color: #333;
    padding: 0 10px;
}

.nav-bar>ul>li>a:hover {
    color: #ff6700;
}

.nav-bar>ul>li:first-child img {
    margin-top: 22.5px;
}

.nav-bar-list {
    width: 100%;
    height: 229px;
    background-color: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 3px 4px rgba(0, 0, 0, .1);
    position: absolute;
    top: 100px;
    left: 0;
    display: none;
    z-index: 999;
}

.nav-bar-list li {
    width: 204px;
    float: left;
}

.nav-bar-list li:last-child .img-box {
    border-right: 0;
}

.img-box {
    width: 100%;
    height: 110px;
    margin-top: 35px;
    border-right: 1px solid #eee;
    box-sizing: border-box;
    margin-bottom: 16px;
}

.nav-bar-list p {
    line-height: 20px;
    font-size: 12px;
}

.name1 {
    color: #333;
}

.price1 {
    color: #ff6700;
}

.nav-bar li:hover .nav-bar-list {
    display: block;
}

.search {
    width: 296px;
    height: 100px;
    background-color: pink;
    float: left;
}

这是我做的部分的截图:

图片.png

这是源码我换了图片之后的截图

图片.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS3新特性 559楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/前端入门与基础知识 560楼

    <style>
        /*
        思路:
        1)绝对定位到需要的位置
        2)display:none; 隐藏
        3)display:block;显示



        */
        *{
            margin: 0;
            padding: 0;
        }
        a{
            text-decoration: none;
        }
        li{
            list-style-type: none;
        }
        .box {
            width: 1226px;
            height: 460px;
            background-color: #008cff;
            margin: 0 auto;

        }

        .slide{
            width: 234px;
            height: 460px;
            background-color: rgba(105,101,101,.6);
            padding: 20px 0;
            box-sizing: border-box;
            position: relative;



        }
        .slide li{
            height: 42px;
            line-height: 42px;
            padding-left: 30px;



        }
        .slide a{
            font-size: 14px;
            color: #fff;
        }
        .a{
            width: 992px;
            height: 460px;
            background-color: pink;
            position: absolute;
            top: 0;
            left: 234px;
            display: none;


        }
        .slide li:hover>.a{
            display: block;


        }



    </style>
</head>
<body>
<div class="box">
    <div class="slide">
        <ul>
            <li>
                <a href="#">手机 电话卡</a>
                <div class="a">1</div>
            </li>
            <li>
                <a href="#">手机 电话卡</a>
                <div class="a">2</div>
            </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="#">手机 电话卡</a></li>

        </ul>


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

老师您好,我想问一下之前隐藏都用的是overflow:hidden;,这次为什么要用display:none|block;

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

    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0 "/>
    <style>
        *{
            margin: 0;
            padding: 0;

        }
        .items{
            width: 25%;
            height: 450px;
            background-color: red;
            float: left;
            padding: 10px;
            box-sizing: border-box;
        }
        .items>div{
            width: 100%;
            height: 100%;
            background-color: green;
        }
        /*移动端*/
        @media screen and (max-width: 768px) {
            .items{
                width: 50%;
            }

        }
        /*ipad端*/
        @media screen and (min-width: 768px) and (max-width: 992px){
            .items{
                width: 33%;
            }
        }
        /*pc端*/
        @media screen and (min-width: 992px) {
            .items{
                width: 25%;
            }
        }
    </style>
</head>
<body>
<div class="box">
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>
    <div class="items">
        <div></div>
    </div>

</div>
</body>

老师您好,视频中老师说的因为适配器的原因(@media),所以得把css里items的宽度取消,但我发现取消与不取消没有任何区别,这是为什么呢

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

1.代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        /*transform转换
        1)translate转换*/
        .box{
            width: 100%;
            height: 500px;
            border: green solid 5px;
        }
        .box1{
            width: 100px;
            height: 100px;
            background-color: purple;
            transform: translate3d(50px,50px,50px);
        }
        /*2)rotate转换*/
        .box2{
            width: 100px;
            height: 100px;
            background-color: yellow;
            transform: translateX(200px) rotate(45deg);
        }
         /*3.scale转换*/
         .box3{
             width: 100px;
             height: 100px;
             background-color:rgba(0,0,255,.5);
             transform: scale(1.5) translateX(50px);
             /*transform: translateX(50px) scale(1.5);*/
             /*为什么这里两种变换的顺序调换,div的位置会不一样?*/
         }

    </style>
</head>
<body>
<div class="box">
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
</div>

</body>
</html>

2.效果图

我的问题有两个:

1)为什么一个transform里面,两种属性值顺序调换,div的位置不一样?(例如Box3,把translateX或是scale放前面,div3的X向位置会不一样)

2)为什么这三个div同为行内元素,做了transform变换以后,位置就不在不同的三行里面?

21.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/CSS选择器 566楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 567楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 568楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 569楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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