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

/* 导航样式开始 */
.nav {
    width: 100%;
    height: 66px;
    background: #88c5e1;
    border-bottom: 5px solid #54abd4;
}

.wrap {
    width: 87%;
    margin: 0 auto;
}

.logo,
.nav-bar,
.search {
    float: left;
    height: 66px;
}


.search .text-input {
    width: 100%;
    height: 40px;
    background-color: #f5f5f5;
    border: 1px solid #f5f5f5;
    box-sizing: border-box;
    border-radius: 2px;
    outline: none;
    margin-top: 13px;
    padding-left: 10px;
    transition: all 0.2s;
}

.search button {
    width: 40px;
    height: 34px;
    background-color: #f5f5f5;
    color: #54abd4;
    font-weight: 900;
    position: absolute;
    top: 16px;
    right: 2px;
}

.text-input:hover {
    background-color: #f5f5f5;
    border-color: #54abd4;
}


.nav-bar>ul {
    float: right;
}

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

.nav-bar ul li a {
    color: #fff;
    padding: 10px;
    display: block;
    margin-left: 8px;
    margin-top: 12.5px;
}

.nav-bar-active {
    border-bottom: 2px solid #fff;
}

.nav-bar a:hover {
    border-bottom: 2px solid #fff;
}

/* 导航样式结束 */

/* **************  响应式设计  *********** */
/* pc端 */
@media screen and(min-width:992px) {
    .logo {
        width: 25%;
        background: url("../images/Brand.png") no-repeat left;
        background-size: 183px;
    }

    .search {
        width: 40%;
        position: relative;
    }

    .nav-bar {
        width: 35%;
    }

    .btn {
        display: none;
    }
}

/* pad端 */
@media screen and(min-width:768px) and (max-width:992px) {
    .logo {
        width: 18%;
        background: url("../images/Brand-M.png") no-repeat left;
        background-size: 86px;
    }

    .search {
        width: 42%;
        position: relative;
    }

    .nav-bar {
        width: 40%;
    }

    .btn {
        display: none;
    }
}

/* M端 */
@media screen and(max-width:768px) {
    .logo {
        width: 16%;
        background: url("../images/Brand-S.png") no-repeat left;
        background-size: 38px;
    }

    .search {
        width: 68%;
        position: relative;
    }

    .nav-bar {
        display: none;
    }

    .btn {
        width: 43px;
        height: 43px;
        border: 1px solid #fff;
        font-weight: 700;
        line-height: 43px;
        float: right;
        color: #fff;
        margin-top: 10.5px;
    }

    .btn i {
        font-size: 20px;
    }
}

也不知道哪里出问题了,对照着源码对了好几遍了,但是源码复制过来就没问题了

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/响应式项目 144楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 145楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/商城官网项目 146楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/商城官网项目 147楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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