会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132358个问题
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 527楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 528楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 529楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/表单 531楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 532楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/商城官网项目 534楼

<style>
        .box {
            width: 300px;
            height: 300px;
        }

        .left {
            float: left;
            width: 100px;
            height: 300px;
            background-color: rgb(209, 106, 106);
        }

        .right {
            float: right;
            width: 200px;
            height: 150px;
        }

        .top {
            float: top;
            width: 200px;
            height: 150px;
            background-color: skyblue;
        }

        .bottom {
            float: bottom;
            width: 200px;
            height: 150px;
        }

        .b-left {
            float: left;
            width: 100px;
            height: 150px;
            background-color: blue;
        }
        .b-right {
            float: right;
            width: 100px;
            height: 150px;
            background-color: rgb(44, 191, 183);
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="left"></div>
        <div class="right">
            <div class="top"></div>
            <div class="bottom">
                <div class="b-left"></div>
                <div class="b-right"></div>
            </div>
        </div>
    </div>
</body>

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/初识CSS 535楼



    
    Title
    
        {
            : ;
        }
        .,.,.{
            : %;
        }
        .{
            : ;
        }
        .{
            : ;
            : ;
            :;
            : ;
            : ;
        }
        .{
            : ;
        }
        .{
            : ;
        }
        .>{
            : ;
            : ;
            : ;
            : ;
            :;
            : ;

        }
        .,.,.,.{
            : ;
        }
        .>{
            : ;
            : ;
            : ;
            : ;
            : ;
        }
        .{
           : ;
            : ;
        }
        .{
            : ;
            : ;
        }
        .{
            : ;
            : ;
        }
        .{
            : ;
        }
        .{
            : ;
            : ;
            : ;
        }
        .{
            : ;
            : ;
        }
        .{
            : ;
            : ;

        }
        .{
            : ;
            : ;

        }
        .{
            : ;
            : ;

        }
        .{
            : ;
        }

    



    
        
            
                
                    18
                    200 | 
                    3999
                    
                
            
            
                
                    18 Pro
                    300 | 
                    4999
                    
                
            

        
        
            
                
                    
                    17AG
                    865 | 120 Hz
                    3699

                
            
            
            
                
                17
                865 | 120 Hz
                3699
            
            
            
                
                    
                    17 Pro
                    1200+12
                    4299
                
            
            
                
                    
                    17 Pro
                    1200+12
                    4299

blob.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/初识CSS 538楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 539楼

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

<!--白色导航部分-->
    <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新特性 540楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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