Css进阶练习(实现抽屉网样式布局)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> *{ margin: 0; padding: 0; } a{ text-decoration: none ; } body{ /*font-family: "Times New Roman";*/ font-size: 12px; } /*====================================head区域设置====================================*/ .head-box{ background-color: #2459a2; height: 44px; width:100%; position:fixed; top:0; left:0; } .head-content{ width: 1016px; height: 44px; line-height: 44px; margin: 0 auto; position: relative; } .head-content .logo{ display:inline-block ; background:url(images/logo.png); width: 121px; height: 23px; float:left; margin: 11px; } .head-content .action-menu{ float: left; margin-left: 5px; } .head-content .action-menu a.tb{ display: inline-block; color: white; margin-left: -3px; padding: 0 16px 0 13px; } .head-content .action-menu a.tb:hover{ color: white; background-color: #396bb3; } .head-content .action-menu a.active,.head-content .action-menu a.active :hover{ color: white; background-color: #204982; } .key-search{ float: right; margin-top: 5px; } .key-search .search-txt{ float: left; width: 91px; height: 25px; padding: 2px 2px 2px 5px; } .key-search a{ display: inline-block; width: 31px; height: 32px; background-color: #f4f4f4; } .key-search a span.search-icon{ display: inline-block; width: 13px; height: 14px; background: url("images/icon.png") no-repeat 0 -195px; margin: 0 0 5px 10px; } .action-nav{ position: absolute; right: 150px; } .action-nav a{ display: inline-block; line-height: 44px; color: white; margin:0 5Px; padding: 0 20px; } .action-nav a:hover{ background-color: #396bb3; } /*====================================head区域设置结束============================*/ /*==================================main-content区域设置===============================*/ /*==========main-content top-area设置==========*/ .main-content-box{ background-color: lightgray; padding-top: 44px; } .main-content{ background-color: white; margin: 0 auto; width: 1016px; height: auto!important; min-height: 700px; overflow: hidden; } .main-content .content-L{ float: left; width: 630px; margin-top: 10px; margin-left: 25px; margin-right: 25px; } .content-L .top-area{ border-bottom: 1px solid #b4b4b4; height: 40px; } .top-area .child-nav a{ display: inline-block; width: 60px; height: 26px; line-height: 26px; color: #369; text-align: center; vertical-align: 4px; } .top-area .child-nav .active{ background: url("images/tip.png") no-repeat 0 -299px; color: black; font-weight:bold; margin-left: 3px; } .top-area .sort-nav { float: left; margin-left: 279px; margin-top:-21px; vertical-align: 4px; } .top-area .sort-nav a{ display: inline-block; text-align: center; color: #390; margin-left: 10px; } .top-area .sort-nav .active{ color: #b4b4b4; } .top-area .publish-btn{ float: right; display:inline-block; width: 136px; height: 32px; background-color: #84a42b; color: white; font-size: 16px; text-align: center; line-height: 32px; margin-top: -27px; } /*=======main-content top-area设置结束=========*/ /*=======main-content content-list设置=========*/ .content-L .content-list{ height: auto; } .content-list .item{ clear: both; padding-top: 10px; border-bottom: 1px solid #b4b4b4; overflow: hidden; } .content-list .item .news-pic{ float: right; margin-left: 10px; padding-bottom: 5px; } .content-list .item .news-pic img{ width: 60px; height: 60px; background-color: white; border: 1px solid #b4b4b4; padding: 1px; text-align: center; } .content-list .news-content{ padding-top: 1px; } .news-content .part1{ line-height: 20px; font-size: 12px; } .news-content .part1 .show-content{ font-size: 14px; color: #369; font-weight: 600; } .news-content .part1 .show-content:hover{ text-decoration: underline; } .news-content .content-source{ color: #b4b4b4; } .news-content .content-kind{ color: #b4b4b4; text-decoration: underline; } .news-content .part2{ padding-top: 6px; margin-bottom: 12px; /*position: relative;*/ left: 0; right: 0; } .news-content .part2 a{ display: inline-block; color: #99accb; min-width: 54px; height: 24px; vertical-align: 4px; } .news-content .part2 a .hand-icon{ display: inline-block; width: 17px; height: 17px; } .news-content .part2 .recommend .icon-recommend{ background: url("images/icon_18_118.png") no-repeat 0 -40px; background-color: #99accb; } .news-content .part2 .recommend .icon-recommend:hover{ background: url("images/icon_18_118.png") no-repeat 0 -20px; } .news-content .part2 a>b{ font-size: 14px; font-weight: 600; vertical-align: 4px; margin-left: 2px; } .news-content .part2 a>b:hover{ text-decoration: underline; color: #2459a2; } .news-content .part2 .discuss .icon-discuss{ background: url("images/icon_18_118.png") no-repeat 0 -100px; background-color: #99accb; } .news-content .part2 .discuss .icon-discuss:hover{ background: url("images/icon_18_118.png") no-repeat 0 -59px; } .news-content .part2 .collect .icon-collect{ background: url("images/icon_18_118.png") no-repeat 0 -161px; } .news-content .part2 .collect b{ font-size: 12px; font-weight: 400; vertical-align: 4px; } .news-content .part2 .collect .icon-collect:hover{ background: url("images/icon_18_118.png") no-repeat 0 -121px; } .news-content .part2 .user-a img { width: 15px; height: 15px; padding: 1px; border: 1px solid #ccc; background-color: #fff; margin-left: 7px; } .news-content .part2 .user-a b{ font-size: 12px; font-weight: 400; vertical-align: 4px; } .news-content .part2 .left .time-a b{ font-size: 12px; font-weight: 400; color: darkorange; margin-left: 7px; } .news-content .part2 span i{ font-size: 12px; font-weight: 400; color: #b4b4b4; vertical-align: 8px; font-style: normal; } .news-content .part2 .time-into i{ margin-left: -7px; } .news-content .part2 .share-site-to i{ margin-left: 7px; } .news-content .part2 .share-site-to .share-icon{ text-align: center; margin-left: 10px; vertical-align: 2px; } .news-content .part2 .share-site-to .share-icon a{ display: inline-block; width: 17px; height: 15px; margin-right: -35px; } .share-icon .icon-sina{ background: url("images/share_icon.png") no-repeat 0 1px; } .share-icon .icon-sina:hover{ background: url("images/share_icon.png") no-repeat 0 -89px; } .share-icon .icon-douban{ background: url("images/share_icon.png") no-repeat 0 -14px; } .share-icon .icon-douban:hover{ background: url("images/share_icon.png") no-repeat 0 -103px; } .share-icon .icon-qqzone{ background: url("images/share_icon.png") no-repeat 0 -30px; } .share-icon .icon-qqzone:hover { background: url("images/share_icon.png") no-repeat 0 -119px; } .share-icon .icon-tenxun{ background: url("images/share_icon.png") no-repeat 0 -45px; } .share-icon .icon-tenxun:hover{ background: url("images/share_icon.png") no-repeat 0 -134px; } .share-icon .icon-renren{ background: url("images/share_icon.png") no-repeat 0 -60px; } .share-icon .icon-renren:hover{ background: url("images/share_icon.png") no-repeat 0 -150px; } /*========main-content content-list设置结束============*/ /*========main-content page-area设置开始==============*/ .main-content .page-area ul{ margin-top: 15px; margin-bottom: 30px; height: 80px; margin-left: 80px; float: left; } .page-area ul li{ display: inline-block; } .main-content .page-area ul li a{ display: inline-block; width: 34px; height: 34px; line-height: 34px; text-align: center; border:1px solid #e1e1e1; border-radius: 15%; margin-left: 5px; } .page-area ul li a.page-next{ width: 50px; } .main-content .page-area ul li .page-a{ font-size: 12px; font-weight: 600; color: #2459a2; margin-top: 8px; } .main-content .page-area ul li .page-a:hover{ background-color: #369; color: white; } .page-area ul li .current_page{ font-size: 12px; font-weight: 600; color: black; margin-top: 8px; } .main-content .content-R{ float: left; } /*=========main-content page-area设置结束============*/ /*==========main-content footer设置开始=============*/ .main-content .footer-box{ clear: both; border-top: 1px solid #b4b4b4; width: 960px; height: 80px; margin-top: 15px; margin-bottom: 15px; margin-left: 28px; margin-right: 28px; } .main-content .footer-box .foot-nav{ text-align: center; margin-top: 10px; } .main-content .footer-box .foot-nav a{ font-size: 12px; color: #396bb3; margin-left: 5px; margin-right: 5px; } .main-content .footer-box .foot-nav a:hover{ text-decoration: underline; } .main-content .footer-box .foot-nav2{ margin-top: 5px; text-align: center; } .main-content .footer-box .foot-nav2 .foot_b{ color: #b4b4b4; } /*==========main-content footer设置完毕============*/ </style> </head> <body> <div class="head-box"> <div class="head-content"> <a href="#" class="logo"></a> <div class="action-menu"> <a href="#" class="tb active">全部</a> <a href="#" class="tb">42区</a> <a href="#" class="tb">段子</a> <a href="#" class="tb">图片</a> <a href="#" class="tb">挨踢1024</a> <a href="#" class="tb">你问我答</a> <a href="#" class="tb">视频</a> </div> <div class="key-search"> <form action="/" method="post"> <input type="text" class="search-txt"> <a href="#" class="search-icon-box"> <span class="search-icon"></span> </a> </form> </div> <div class="action-nav"> <a href="#" class="register-btn">注册</a> <a href="#" class="login-btn">登录</a> </div> </div> </div> <div class="main-content-box"> <div class="main-content"> <div class="content-L"> <div class="top-area"> <div class="child-nav"> <a href="#" class="hotbtn active" >最热</a> <a href="#" class="newbtn" >最新</a> <a href="#" class="personbtn" >人类发布</a> </div> <div class="sort-nav"> <a href="#" class="sortbtn active" >即时排序</a> <a href="#" class="newbtn" >24小时</a> <a href="#" class="newbtn" >3天</a> </div> <a href="#" class="publish-btn"> <span class="n2">+ 发布</span> </a> </div> <div class="content-list"> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss" title="评论"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> </span> </span> </div> </div> </div> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <!-- 分享各微博的按钮 --> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> <a class="share-none"> </a> </span> </span> </div> </div> </div> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <!-- 分享各微博的按钮 --> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> <a class="share-none"> </a> </span> </span> </div> </div> </div> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <!-- 分享各微博的按钮 --> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> <a class="share-none"> </a> </span> </span> </div> </div> </div> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <!-- 分享各微博的按钮 --> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> <a class="share-none"> </a> </span> </span> </div> </div> </div> <div class="item"> <div class="news-pic"> <img src="images/news.jpg" alt="抽屉新热榜"> </div> <div class="news-content"> <div class="part1"> <a href="#" class="show-content" target="_blank"> @大脸撑在小胸:刚在以色列大使馆经历史上最严的安检。过完常规扫描还有二 次安检,包里所有东西都掏出来,唇膏拧开,粉盒打开,润喉糖打开,钱包里所有卡和钱摸 一遍,纸巾摸一遍,包包链子每一个扣都仔细摸过。对方一直说还有东西但找不到,我都慌 了以为被人偷放了,最后终于从小袋角落摸出一颗不知何时掉的维生素。 </a> <span class="content-source">-ww4.sinaimg.cn</span> <a href="#" class="n2"> <span class="content-kind">42区</span> </a> </div> <div class="part2"> <a href="#" class="recommend" title="推荐"> <span class="hand-icon icon-recommend"></span> <b>4</b> </a> <a href="javascript:;" class="discuss"> <span class="hand-icon icon-discuss"></span> <b>5</b> </a> <a href="javascript:;" class="collect" title="加入私藏"> <span class="hand-icon icon-collect"></span> <b>私藏</b> </a> <a href="#" class="user-a"> <span> <img src="images/13.png"> </span> <b>乱太郎</b> </a> <span class="left time-into"> <a class="time-a" href="#" target="_blank"> <b>4分钟前</b> </a> <i>入热榜</i> </span> <!-- 分享各微博的按钮 --> <span class="share-site-to"> <i>分享到</i> <span class="share-icon"> <a class="icon-sina" title="分享到新浪微博" href="#" ></a> <a class="icon-douban" title="分享到豆瓣" href="#" ></a> <a class="icon-qqzone" title="分享到QQ空间" href="#" ></a> <a class="icon-tenxun" title="分享到腾讯微博" href="#" ></a> <a class="icon-renren" title="分享到人人网" href="#" ></a> <a class="share-none"> </a> </span> </span> </div> </div> </div> </div> <div class="page-area"> <ul> <li><span class="current_page">1</span></li> <li><a href="#" class="page-a">2</a></li> <li><a href="#" class="page-a">3</a></li> <li><a href="#" class="page-a">4</a></li> <li><a href="#" class="page-a">5</a></li> <li><a href="#" class="page-a">6</a></li> <li><a href="#" class="page-a">7</a></li> <li><a href="#" class="page-a">8</a></li> <li><a href="#" class="page-a">9</a></li> <li><a href="#" class="page-a">10</a></li> <li><a href="#" class="page-a page-next">下一页</a></li> </ul> </div> </div> <div class="content-R"></div> <div class="footer-box"> <div class="foot-nav"> <a href="#" target="_blank">关于我们</a> <span>|</span> <a href="#" target="_blank">联系我们</a> <span>|</span> <a href="#" target="_blank">服务条款</a> <span>|</span> <a href="#" target="_blank">隐私政策</a> <span>|</span> <a href="#" target="_blank">抽屉新热榜工具</a> <span>|</span> <a href="#" target="_blank">下载客户端</a> <span>|</span> <a href="#" target="_blank">意见与反馈</a> <span>|</span> <a href="#" target="_blank">友情链接</a> <span>|</span> <a href="#" target="_blank">公告</a> <a href="#" style="margin-left:0;vertical-align:-2px;"> <img src="images/ct_rss.gif" width="36" height="14"> </a> </div> <div class="foot-nav2"> <a target="_blank" href="#"> <img class="foot_e" src="images/footer1.gif" width="36" height="14"> </a> <span class="foot_d">旗下站点</span> <span class="foot_a">©2016chouti.com</span> <a target="_blank" href="#" class="foot_b">京ICP备09053974号-3 京公网安备 110102004562</a> <div style="margin-top:6px;">版权所有:北京格致璞科技有限公司</div> </div> </div> </div> </div> </body> </html>