css布局实现自适应响应式博客首页效果代码
代码语言:html
所属分类:响应式
代码描述:css布局实现自适应响应式博客首页效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <meta name="applicable-device" content="pc,mobile"> <meta name="author" content="order by"> <title>折优优</title> <meta name="keywords" content="" /> <meta name="description" content="折优优 网站定制,wordpress模板" /> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/swiper.min.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css"> <style> * { margin: 0; padding: 0; font-family: yilong, Helvetica, Arial, "Open Sans", Arial, 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans CN', Roboto, 'Microsoft Yahei', sans-serif; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body { font-size: 14px; background: #F6F6F6; } a { color: inherit; text-decoration: none; -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -ms-transition: all .3s ease; -o-transition: all .3s ease; transition: all .3s ease } a:hover { color: #00A7EB } ul, li, p, h1, h2, h3 { list-style-type: none; margin: 0; padding: 0; } h1, h2, h3, h4, h5, h6 { font-weight: 400; line-height: 1.4; color: #273746; margin: 0; } .mask { width: 100%; height: 100%; position: fixed; top: 0; left: 0; display: none; background: #000; opacity: 0.5; -webkit-opacity: 0.5; z-index: 100; } @font-face { font-family: yilong; font-weight: 400 } .red { padding-top:12px; color: #f54335; } @keyframes mymove { from { -webkit-transform: rotate(45deg); transform:rotate(45deg); } to { -webkit-transform: rotate(225deg); transform: rotate(225deg); } } @-webkit-keyframes mymove { from { -webkit-transform: rotate(45deg); transform:rotate(45deg); } to { -webkit-transform: rotate(225deg); transform: rotate(225deg); } } @keyframes mymovex { from { -webkit-transform: rotate(0deg); transform:rotate(0deg); } to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @-webkit-keyframes mymovex { from { -webkit-transform: rotate(0deg); transform:rotate(0deg); } to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @-webkit-keyframes fade-zoom-in { 0% { opacity:0; -webkit-transform:scale(1.1); transform:scale(1.1) } 100% { opacity:1; -webkit-transform:scale(1); transform:scale(1) } } @-o-keyframes fade-zoom-in { 0% { opacity:0; -o-transform:scale(1.1); transform:scale(1.1) } 100% { opacity:1; -o-transform:scale(1); transform:scale(1) } } @keyframes fade-zoom-in { 0% { opacity:0; -webkit-transform:scale(1.1); -o-transform:scale(1.1); transform:scale(1.1) } 100% { opacity:1; -webkit-transform:scale(1); -o-transform:scale(1); transform:scale(1) } } .wrap { max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 15px; position: relative; } .row { margin-left: -15px; margin-right: -15px; } .backtop { width: 50px; height: 50px; text-align: center; line-height: 50px; background: #282828; opacity: 0.6; position: fixed; right: 20px; bottom: 50px; cursor: pointer; } .backtop i { color: #fff; } .backtop.cd-is-visible { /* the button becomes visible */ visibility: visible; opacity: 1; } .backtop.cd-fade-out { /* å¦æç¨æ·ç»§ç»å䏿»å¨,è¿ä¸ªæé®çéæåº¦ä¼å徿´ä½ */ opacity: .5; } .no-touch .backtop:hover { background-color: #e86256; opacity: 1; } .subbody { padding: 110px 0 0 0; } .topmenu { height: 91px; background: #fff; position: fixed; width: 100%; z-index: 11; top: 0; left: 0; border-bottom: 1px solid #dedede; } .logo { float: left; padding: 10px 0; width: 25%; } .logo img { width: 100px; height: 36px; margin-top: 18px; } .menu { float: left; width: 75%; } li.closex { display: none; } .search { width: 50px; position: absolute; right: 0; top: 35px; } .search i { font-weight: bold; font-size: 20px; cursor: pointer; } .search-box { width: 100%; height: 100%; background: #fff; position: fixed; z-index: 100; top: 0; left: 0; display: none; font-size: 16px; -webkit-animation: fade-zoom-in .3s forwards; -o-animation: fade-zoom-in .3s forwards; animation: fade-zoom-in .3s forwards; } .search-close { width: 1000px; height: 60px; margin: 0 auto; padding: 100px 0 0 0; } .search-close i { float: right; font-size: 40px; color: #666; cursor: pointer; } .search-close i:hover { animation: mymovex 0.5s 1; -webkit-animation: mymovex 0.5s 1; } dl.se { overflow: hidden; } dl.se dt { width: 500px; float: left; } dl.se dt input { width: 100%; height: 54px; padding: 0 10px; border: 1px solid #dedede; border-radius: 5px; } dl.se dd button { width: 100%; border: 0; background: #000; color: #fff; height: 56px; border-radius: 0 5px 5px 0; } dl.se dd { width: 100px; float: right; } .search-con { width: 600px; margin: 0 auto; padding-top: 20px; } .search-tips { line-height: 50px; padding-top: 30px; } .search-as { line-height: 34px; } .search-as a { padding: 0 20px; border: 1px solid #dedede; display: inline-block; margin-right: 10px; margin-bottom: 10px; white-space: nowrap; border-radius: 5px; color: #ccc; } .search-as a:hover { color: #666; border: 1px solid #666; } /*menu*/ #nav { width: 800px; display: block; margin-top: 25px; } #nav .mainlevel { float: left; border-right: 1px solid #fff; position: relative; z-index: 10; } #nav .mainlevel a { color: #000; text-decoration: none; line-height: 40px; display: block; padding: 0 20px; font-size: 17px; } #nav .mainlevel a i { width: 6px; height: 6px; border-bottom: 2px solid #666; border-right: 2px solid #666; display: block; -webkit-transform: rotate(45deg); transform: rotate(45deg); float: right; margin-top: 16px; margin-left: 10px; } #nav .mainlevel a:hover, #nav .mainlevel a.hover { color: #19B5FE; text-decoration: none; } #nav .mainlevel a:hover i { animation: mymove 0.2s 1; -webkit-animation: mymove 0.2s 1; transform: rotate(225deg); margin-top: 19px; border-bottom: 2px solid #19B5FE; border-right: 2px solid #19B5FE; } #nav .mainlevel ul { display: none; position: absolute; background: #fff; box-shadow: 1px 3px 5px #888888; border-top: 0; } #nav .mainlevel li { background: #fff; color: #19B5FE; font-size: 15px; width: 140px;/*IE6 only*/ } .main { clear: both; padding: 120px 0 0px 0; overflow: hidden; } .banner { width: 66.666666%; float: left; padding: 0 15px; } .banner-info { position: absolute; z-index: 12; } .swiper-pagination-bullet { width: 25px; height: 3px; border-radius: 0; background: #fff; } .swiper-slide { float: left; width: 100%; height: 430px; background-repeat: no-repeat; background-position: center 0; background-size: auto 430px; } .swiper-button-prev, .swiper-button-next { display: none; opacity: 0.6; width: 36px; height: 60px; } .swiper-button-prev { background: url(../images/l1.png) no-repeat; } .swiper-button-next { background: url(../images/r1.png) no-repeat; } .top-news { width: 33.333333%; float: left; padding: 0 15px; } .top-news2 { width: 100%; float: left; margin-bottom: 30px; } .top-news-box { background: #FFF; -webkit-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); -moz-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); } .top-news h2, .top-news2 h2 { font-size: 20px; padding: 0 10px; font-weight: normal; line-height: 54px; border-top: 2px solid #000; } .top-img { padding: 0; } .top-img img { max-width: 100%; } ul.topnews li a { line-height: 39px; display: block; height: 39px; overflow: hidden; padding: 0 10px; font-size: 15px; } ul.topnews li a:hover { background: #333; color: #fff; } ul.topnews li a i { font-size: 10px; margin-right: 15px; float: left; font-weight: bold; } .hotnews { clear: both; padding-top: 15px; overflow: hidden; } .hotnewlist { width: 33.333333%; float: left; height: 200px; padding: 0 15px; } .hotdiv { width: 100%; height: 100%; position: relative; background-size: cover; background-repeat: no-repeat; background-position: center 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; display: inline-table; overflow: hidden; } .overlay { width: 100%; height: 100%; background: -webkit-linear-gradient(270deg, rgba(0,0,0,.01) 2%, rgba(0,0,0,.95) 100%); background: linear-gradient(180deg, rgba(0,0,0,.01) 2%, rgba(0,0,0,.95) 100%); -webkit-transition: opacity .4s ease-in-out; transition: opacity .4s ease-in-out; position: absolute; } .hotnewlist:hover .overlay { opacity: 0.2; } .title { position: absolute; text-shadow: 1px 1px 2px #000; bottom: 0; padding: 20px 18px; left: 0; right: 0; } .title span { padding: 4px 10px; background-color: #19B5FE; color: #fff; font-size: 13px; margin: 0 5px 5px 0; border-radius: 2px; display: inline-block; text-shadow: none; line-height: 1; } .title h3 { color: #fff; display: block; font-size: 16px; max-height: 48px; overflow: Hidden; font-weight: normal; } .swiper-slide .title h3.f20 { font-size: 25px; } .swiper-slide .title { padding: 0 10px 30px 18px; } .mainbody { clear: both; padding-top: 40px; overflow: hidden; } .left { width: 66.666666%; float: left; padding: 0 15px; } .right { width: 33.333333%; float: right; padding: 0 15px; } .post-nav { padding: 0 10px; margin-bottom: 15px } .post-nav span { cursor: pointer; position: relative; background: #FFF; display: inline-block; border-radius: 30px; padding: 11px 25px; margin-top: 10px; margin-right: 25px; margin-bottom: 10px; border: 1px solid #eae9e9; -moz-transition: all .3s ease-in-out; -webkit-transition: all .3s ease-in-out; transition: all .3s ease-in-out; -webkit-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); -moz-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); box-shadow: 0 0 10px 0 rgba(146,146,146,.1) } .post-nav span.current, .post-nav span:hover { background: #282828; color: #FFF; border: 1px solid #282828 } .morebtn { text-align: center; clear: both; padding: 30px 0; } .morebtn button { cursor: pointer; border: 0; width: 150px; background: #00a7eb; border-radius: 2px; font-size: 16px; color: #fff; height: 46px; line-height: 46px; display: inline-block; margin: 0 8px; -moz-transition: all .3s ease-in-out; -webkit-transition: all .3s ease-in-out; transition: all .3s ease-in-out; } .morebtn button:hover { background: #0298d4 } .footer { width: 100%; position: relative; clear: both; background-color: #282828; margin-top: 30px; padding: 30px 0 30px 0; } .footer .footer-copyright { float: left; font-size: 15px; line-height: 1.6 } .footer .footer-copyright a { color: #ddd } .footer .footer-copyright a:hover { color: #FFF; color: #ddd } .footer .footer-social { float: right; margin-top: 0; position: relative } .footer .footer-social a { font-size: 20px; margin-left: 10px } .footer .footer-social a:first-child { margin-left: 0 } .footer .copyright-footer p { color: #828282 } .footer .copyright-footer a { color: #929292 } .footer .links-footer { font-size: 10px; color: #353e4a; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.05); margin-top: 20px } .footer .links-footer a, .footer .links-footer span { color: #696969; line-height: 1.2; margin: 0 5px 0 0; font-size: 12px } .footer .nav-footer { margin-bottom: 20px } .footer .nav-footer a { color: #e0e0e0; margin-right: 10px; font-size: 15px } .footer .footer-box .nav-footer a:hover { color: #FFF } .footer .footer-box .nav-footer span { margin: 0 10px } .social-footer a i { font-size: 20px; color: #fff; } .social-footer { float: right } .social-footer a { position: relative; float: left; width: 40px; height: 40px; line-height: 40px; background-color: #343a40; text-align: center; border-radius: 20px; margin: 0 5px; color: #FFF; font-size: 16px } .social-footer a i { color: #c5c5c5 } .social-footer a:hover i { color: #FFF } .social-footer a.ketangdibu:hover { background-color: #f74864 } .social-footer a.taobaodibu:hover { background-color: #FF4200 } .social-footer a.mailii i { font-size: 16px; } .social-footer a.mailii:hover { background-color: #e64c4c } .social-footer a.wangxiaodibu:hover { background-color: #00C5FF } .social-footer a.wxii:hover { background-color: #35a999 } .items { position: relative; overflow: hidden; display: block; margin-bottom: 30px; background: #FFF; -webkit-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); -moz-box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); box-shadow: 0 5px 10px 0 rgba(146,146,146,.1); } .content-box { overflow: hidden; padding: 32px 27px; } .posts-gallery-img { position: relative; float: left; width: 231.98px; max-height: 173.98px; height: auto; overflow: hidden } .posts-gallery-img img { width: 100%; min-height: 173.98px; transition: 0.5s; } .posts-gallery-img img:hover:hover { transform: scale(1.1); -webk.........完整代码请登录后点击上方下载按钮下载查看
网友评论0