css布局实现自适应响应式知识问答平台首页效果代码

代码语言:html

所属分类:布局界面

代码描述:css布局实现自适应响应式知识问答平台首页效果代码

代码标签: 适应 响应 知识问答 平台 首页 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>问答</title>
    <meta name="keywords" content="关键词" />
    <meta name="description" content="描述" />

    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <style>
@charset "utf-8";
        /* CSS Document */
        * {
            margin: 0;
            padding: 0;
            -webkit-tap-highlight-color: transparent;
        }
        body {
            font-family: 'microsoft yahei';
        }
        a {
            text-decoration: none;
            color: #333;
            -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
            -webkit-user-select: none;
            -moz-user-focus: none;
            -moz-user-select: none;
        }
        .l {
            float: left;
        }
        .r {
            float: right;
        }
        .textcenter {
            text-align: center;
        }
        li {
            list-style-type: none;
        }
        em {
            font-style: normal
        }
        .block {
            display: block;
        }
        .none {
            display: none;
        }
        .border3 {
            border-radius: 3px;
        }
        .border5 {
            border-radius: 3px;
        }
        .mrw10 {
            margin-right: 10px;
        }
        .miw10 {
            margin-left: 10px;
        }
        .mrw15 {
            margin-right: 15px;
        }
        .miw15 {
            margin-left: 15px;
        }
        .mrw20 {
            margin-right: 20px;
        }
        .mlw20 {
            margin-left: 20px;
        }

        #UpdateHint {
            width: 100%;
            height: auto;
            overflow: hidden;
            display: none;
            margin: 0 auto -100px auto;
            position: fixed;
            left: 0;
            top: 50%;
            z-index: 99999999;
            text-align: center;
        }
        #UpdateHint span {
            display: inline-block;
            vertical-align: middle;
            padding: 20px 30px;
            background: rgba(0,0,0, 0.8);
            font: 20px/30px 'microsoft yahei';
            text-align: center;
            color: #fff;

        }
        #UpdateHint .ok {
            font: 20px/30px 'microsoft yahei';
            color: #fff;
            background: rgba(18,166,10, 0.8);
        }

        /*大于1024像素*/
@media all and (min-width:1020px) {
            .maxw {
                max-width: 1020px;
            }
            /*显示与隐藏*/
            .pc {
                display: block;
            }
            .move {
                display: none;
            }
            .headerTOPH {
                height: 48px;
            }
            .headerTOPH2 {
                height: 0px;
            }
            .topFloat {
                width: 100%;
                height: 48px;
                position: fixed;
                top: 0;
                left: 0;
                z-index: 9999;
            }
            header {
                width: 100%;
                height: 48px;
                background-color: #2D2E2F;
            }
            header .maxw {
                width: 100%;
                height: 48px;
                margin: 0 auto;
            }
            header .maxw .logo {
                display: block;
                height: 48px;
                float: left;
                margin-right: 18px;
            }
            header .maxw .logo img {
                display: block;
                height: 48px;
            }
            header .maxw nav {
                float: left;
                height: 48px;
            }

            header .maxw section {
                float: right;
                height: 48px;
            }
            header .maxw section .txtbur {
                display: block;
                float: left;
                height: 48px;
                padding: 0 8px;
                line-height: 48px;
                font-size: 15px;
                color: #fff;
            }
            header .maxw section .txtbur:hover {
                color: #F8B600;
            }

            .PCNenuMain {
                display: block;
                height: 48px;
                float: left;
                position: relative;
            }
            .PCNenuMain .mn {
                display: block;
                height: 48px;
                float: left;
                padding: 0 15px;
                transition-duration: 0.2s;
            }
            .PCNenuMain .mn:hover {
                background-color: #151616;
            }
            .PCNenuMain .mn a {
                display: block;
                height: 48px;
                line-height: 48px;
                font-size: 15px;
                color: #fff;
                float: left;
            }
            .PCNenuMain .mn i {
                display: block;
                height: 48px;
                line-height: 52px;
                font-size: 1px;
                margin-left: 5px;
                color: #999;
                float: left;
                transition-duration: 0.2s;
            }
            .PCNenuMain .mn:hover i {
                line-height: 46px;
                -webkit-transform: rotate(180deg);
                /*Safari 4+,Google Chrome 1+ */
                -moz-transform: rotate(180deg);
                /*Firefox 3.5+*/
                filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=1);
                /*ie*/
            }
            .PCNenuMain .mn .sonClass {
                width: 522px;
                height: 0;
                overflow: hidden;
                background-color: #FC0;
                position: absolute;
                top: 48px;
                left: 0px;
                transition-duration: 0.2s;
                z-index: 999;
                padding: 0 15px;
                background: rgba(0,0,0, 0.8);
            }
            .PCNenuMain .mn:hover .sonClass {
                height: auto;
                padding: 10px 15px 16px 15px;
            }
            .PCNenuMain .mn:hover .sonClass li {
                display: block;
                height: 32px;
                float: left;
            }
            .PCNenuMain .mn:hover .sonClass li a {
                display: block;
                height: 32px;
                text-align: center;
                line-height: 31px;
                padding: 0 15px;
                font-size: 14px;
                color: #ccc;
                transition-duration: 0.2s;
                border-radius: 3px;
            }
            .PCNenuMain .mn:hover .sonClass li a:hover {
                color: #fff;
                background-color: #151616;
            }
            header .maxw .PCsearch {
                display: block;
                width: 260px;
                height: 34px;
                margin: 7px 0 0 30px;
                background-color: #505050;
                float: left;
            }
            header .maxw .PCsearch .serachKey {
                border: 0;
                outline: none;
                background-color: transparent;
                width: 198px;
                padding: 0 10px;
                height: 34px;
                float: left;
                font: 14px/30px 'microsoft yahei';
                color: #f30;
                margin: 0 auto;
            }
            header .maxw .PCsearch .sobut {
                width: 34px;
                height: 34px;
                border: 0;
                outline: none;
            }



            header .maxw .menu {
                height: 52px;
                float: right;
                display: none;
            }
            .MNenuMain {
                display: none;
            }
            .MNenuMain .mnName {
                width: 100%;
                height: 52px;
                background-color: #2D2E2F;
            }
            .MNenuMain .mnName h1 {
                display: block;
                height: 52px;
                float: left;
                margin-left: 10px;
                line-height: 52px;
                font-size: 16px;
                color: #E4E4E4;
                font-weight: normal;
            }
            .MNenuMain .mnName .menuClose {
                display: block;
                float: right;
                margin-right: 10px;
                height: 52px;
                cursor: pointer;
            }
            .MNenuMain .mnName .menuClose i {
                display: block;
                height: 52px;
                line-height: 52px;
                width: 25px;
                font-size: 22px;
                color: #F8B600;
            }
            .MNenuMain .navmain {
                display: block;
                width: 100%;
                height: auto;
                overflow: hidden;
                background: rgba(0,0,0, 0.7);
            }
            .MNenuMain .navmain .son {
                width: 100%;
                height: auto;
                overflow: auto;
            }
            .MNenuMain .navmain li.son .mbut {
                display: block;
                width: 92%;
                height: 46px;
                padding: 0 4%;
                line-height: 46px;
                font-size: 14px;
                color: #fff;
                background: rgba(40,40,40, 0.3);
                border-bottom: 1px solid #2D2E2F;
                cursor: pointer;
            }
            .MNenuMain .navmain li.son .mbut em {
                color: #888;
                margin-left: 15px;
            }
            /*二级菜单样式*/
            .MNenuMain .navmain li.son ul.SonContent {
                width: 96%;
                height: auto;
                padding: 8px 0;
                margin: 0 auto;
                overflow: hidden;
                z-index: 999999;
                text-align: center;
            }
            .MNenuMain .navmain li.son ul.SonContent li {
                display: inline-block;
                vertical-align: middle;
                height: 38px;
            }
            .MNenuMain .navmain li.son ul.SonContent li a {
                display: block;
                float: left;
                height: 32px;
                line-height: 31px;
                margin: 0 3px;
                font-size: 14px;
                color: #ccc;
                background: rgba(40,40,40, 0.5);
                padding: 0 15px;
                border-radius: 3px;
            }
            .MNenuMain .navmain .login {
                width: 100%;
                height: auto;
                overflow: hidden;
                padding-bottom: 18px;
                margin: 0 auto;
                background: rgba(40,40,40, 0.8);
            }
            .MNenuMain .navmain .login .search {
                min-width: 280px;
                width: 96%;
                height: 42px;
                background-color: #ddd;
                margin: 15px auto 0 auto;
                border-radius: 4px;
                position: relative;
            }
            .MNenuMain .navmain .login .search .serachKey {
                border: 0;
                outline: none;
                background-color: transparent;
                width: 90%;
                height: 30px;
                float: left;
                margin-left: 10px;
                margin-top: 4px;
                margin-right: 10px;
                font: 14px/30px 'microsoft yahei';
                color: #f30;
            }
            .MNenuMain .navmain .login .search .button {
                display: block;
                border: 0;
                outline: none;
                background-color: #7FBD0D;
                color: #fff;
                height: 32px;
                padding: 0 15px;
                border-radius: 3px;
                line-height: 32px;
                font-size: 14px;
                position: absolute;
                right: 5px;
                top: 5px;
            }

            .MNenuMain .navmain .login h2 {
                width: 100%;
                height: 42px;
                padding-top: 10px;
                text-align: center;
            }
            .MNenuMain .navmain .login h2 a {
                display: inline-block;
                vertical-align: middle;
                height: 42px;
                padding: 0 15px;
                margin: 0 8px;
                border-radius: 21px;
            }
            .MNenuMain .navmain .login h2 a.b1 {
                background-color: #7FBD0D;
            }
            .MNenuMain .navmain .login h2 a.b2 {
                background-color: #F8B600;
            }
            .MNenuMain .navmain .login h2 a i {
                display: block;
                width: 26px;
                height: 26px;
                text-align: center;
                line-height: 26px;
                font-size: 16px;
                float: left;
                margin-top: 7px;
                border: 1px solid #ddd;
                color: #fff;
                margin-right: 6px;
                border-radius: 15px;
            }
            .MNenuMain .navmain .login h2 a span {
                display: block;
                height: 30px;
                float: left;
                line-height: 30px;
                font-size: 16px;
                color: #fff;
                margin-top: 6px;
                font-weight: normal;
            }

            footer {
                width: 100%;
                height: auto;
                overflow: hidden;
                padding: 10px 0;
                background-color: #3C3C3C;
            }
            footer section {
                height: auto;
                overflow: hidden;
                margin: 0 auto;
            }
            footer section p {
                width: 100%;
                line-height: 30px;
                font-size: 14px;
                color: #ccc;
                text-align: center;
            }

        }












        /*小于1024像素*/
@media all and (max-width:1020px) {
            .maxw {
                max-width: 900px;
            }
            /*显示与隐藏*/
            .pc {
                display: none;
            }
            .move {
                display: block;
            }
            .headerTOPH {
                height: 52px;
            }
            .headerTOPH2 {
                height: 58px;
            }
            header {
                width: 100%;
                min-width: 280px;
                height: 52px;
                background-color: #2D2E2F;
                position: fixed;
                top: 0;
                z-index: 999;
            }
            header .maxw {
                width: 96%;
                height: 52px;
                margin: 0 auto;
            }
            header .maxw .logo {
                display: block;
                height: 52px;
                float: left;
                margin-right: 18px;
            }
            header .maxw .logo img {
                display: block;
                height: 40px;
                margin-top: 6px;
            }

            header .maxw .menu {
                height: 52px;
                float: right;
            }
            header .maxw .menu i {
                display: block;
                width: 36px;
                font-size: 26px;
                color: #F8B600;
                text-align: center;
                line-height: 52px;
            }
            header .maxw section {
                display: none;
            }
            header .maxw .PCsearch {
                display.........完整代码请登录后点击上方下载按钮下载查看

网友评论0