知识预览

  • 需求
  • 设计布局
  • 代码参考 



回到顶部



需求

element 抽屉宽度_ico



回到顶部



设计布局

header区域

画盒子

element 抽屉宽度_ico_02

设计html结构

element 抽屉宽度_css_03

content区域 

画盒子

element 抽屉宽度_ico_04

 

设计html结构

element 抽屉宽度_css_05

 content-L区域

画盒子

element 抽屉宽度_ico_06

设计html结构

element 抽屉宽度_element 抽屉宽度_07

 



回到顶部



代码参考 

html




element 抽屉宽度_element 抽屉宽度_08

element 抽屉宽度_html_09

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="chouti.css">
</head>
<body>



    <!--header结构-->
    <div class="header">

         <div class="header_content">

               <div class="logo">
                   <a href="/"><img src="images/logo.png" alt=""></a>
               </div>

               <div class="action-menu">

                        <a href="#" class="tb active">全部</a>
                        <a href="#" class="tb item">42区</a>
                        <a href="#" class="tb item">段子</a>
                        <a href="#" class="tb item">图片</a>
                        <a href="#" class="tb item">挨踢1024</a>
                        <a href="#" class="tb item">你问我答</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>


    <!--content结构-->

    <div class="content-box">

        <div class="content">

            <div class="content-L">

                <div class="top-area clearfix">

                    <div class="part1">
                        <a href="#"  class="hotbtn active" >最热</a>
                        <a href="#"  class="newbtn"    >最新</a>
                        <a href="#"  class="personbtn" >人类发布</a>
                    </div>
                    <div class="part2">
                        <a href="#"  class="sortbtn active" >即时排序</a>
                        <a href="#"  class="btnByhour" >24小时</a>
                        <a href="#"  class="btnByday" >3天</a>
                    </div>
                    <a href="#" class="part3">
                        <span class="n2">+  发布</span>
                    </a>

                </div>

                <div class="article-list">

                      <div class="item clearfix">

                                <div class="news-pic">
                                    <img src="a.png" alt="抽屉新热榜">
                                </div>
                                <div class="news-content">
                                    <div class="content-text">
                                            <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="content-icon">


                                            <a href="#" class="recommend" title="推荐">
                                                <span class="hand-icon icon-recommend"></span>
                                                <b>4</b>
                                            </a>

                                            <a href="#" class="discuss">
                                                <span class="hand-icon icon-discuss"></span>
                                                <b>5</b>
                                            </a>


                                            <a href="#" 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="time-into">
                                            <a class="time-a" href="#">
                                                <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 clearfix">

                                <div class="news-pic">
                                    <img src="a.png" alt="抽屉新热榜">
                                </div>

                                <div class="news-content">
                                    <div class="content-text">
                                            <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="content-icon">


                                            <a href="#" class="recommend" title="推荐">
                                                <span class="hand-icon icon-recommend"></span>
                                                <b>4</b>
                                            </a>

                                            <a href="#" class="discuss">
                                                <span class="hand-icon icon-discuss"></span>
                                                <b>5</b>
                                            </a>


                                            <a href="#" 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="time-into">
                                            <a class="time-a" href="#">
                                                <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 clearfix">

                                <div class="news-pic">
                                    <img src="a.png" alt="抽屉新热榜">
                                </div>

                                <div class="news-content">
                                    <div class="content-text">
                                            <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="content-icon">


                                            <a href="#" class="recommend" title="推荐">
                                                <span class="hand-icon icon-recommend"></span>
                                                <b>4</b>
                                            </a>

                                            <a href="#" class="discuss">
                                                <span class="hand-icon icon-discuss"></span>
                                                <b>5</b>
                                            </a>


                                            <a href="#" 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="time-into">
                                            <a class="time-a" href="#">
                                                <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>

                <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>

         <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="#">
                        <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>



</body>
</html>


View Code


css




element 抽屉宽度_element 抽屉宽度_08

element 抽屉宽度_html_09

/*======================================初始化=====================*/
            *{
             margin: 0;
             padding: 0;
                  }

            body{
                font-size: 12px;
            }

            a{
              text-decoration: none;
            }

        /*======================================header区域设置=====================*/
        .header{
               height: 44px;
               width: 100%;
               background-color: #2459a2;
               position: fixed;
               top:0;
               left: 0;
        }

        .header_content{
            width: 80%;
            height: 44px;
            background-color: #2459a2;
            margin: 0 auto;
            line-height: 44px;
            position: relative;

        }


/*======header区part1:logo ===========*/


               .logo{

                    float: left;
                    width: 121px;
                    height: 23px;
                    margin-top: 9px;

                }

/*======header区part2:action-menu =====*/

               .action-menu{
                    float: left;
                    margin-left: 30px;
                }

                .action-menu a.tb{
                            color: #c0cddf;
                            padding: 12px 13px 12px 16px;
                            /*float: left;*/
                            /*display: inline-block;*/
                        }

                .action-menu a.tb:hover {
                    color: #fff;
                    background-color: lightslategrey;

                }

                 .action-menu a.active, .action-menu a.active:hover {
                                color: #fff;
                                background-color:#204982;;

                            }

/*======header区part3:key-search =====*/

                 .key-search{
                         margin-top: 5px;
                         float: right;
                    }


                 .key-search a.search-icon-box, .search-txt {
                        float: left;
                    }

                .search-txt {

                    color: #333;
                    line-height: 25px;
                    padding: 2px 2px 2px 5px;
                    height: 25px;
                    width: 91px;

                }

                .key-search a.search-icon-box {
                    border: 1px solid #e0e0e0;
                    background-color: #f4f4f4;
                    width: 30px;
                    height: 31px;
                    border-left: 0;
                }


                .key-search a.search-icon-box span.search-icon{
                    background: url("images/icon.png") no-repeat 0 -197px;
                    float: left;
                    height: 12px;
                    width: 11px;
                    margin-left: 10px;
                    margin-top: 9px;
                }

/*======header区part4:action-nav =====*/

                .action-nav {
                       float: right;
                       margin-right: 10px;
                    }

                 .action-nav a {
                        color: #fff;
                        padding: 14px 18px;

                    }

                .action-nav a:hover{
                    background-color: lightslategrey;
                    color: white;
                }
 /*======================================content区域设置=====================*/

             .content-box {
                    background-color: #ededed;
                    padding-top: 44px;
                    height: 100%;
                }

             .content {
                    width: 960px;
                    margin: 0 auto;
                    height: auto!important;
                    overflow: hidden;
                    min-height: 713px;
                    padding: 6px 28px;
                    background-color: #fff;
                    /*overflow: hidden;取消后看看效果*/
                }

              .content-L {
                    width: 630px;
                    margin-top: 5px;
                    float: left;
                    border: dashed 2px darkorange;
                }

              .content-R {
                    width: 300px;
                    margin-top: 5px;
                    float: left;
                }




/*======content区域设置part1: toparea =====*/


        .top-area {
            /*overflow: hidden清除浮动*/
            /*overflow: hidden;*/
            border-bottom: 1px solid #ccdcef;
        }

        .part1, .part2 {
            float: left;
            padding: 10px;
        }


        .part1 .hotbtn {
            margin-left: 5px;
        }

        .part1 a {
            display: inline-block;
            width: 60px;
            height: 26px;
            line-height: 26px;
            margin-top: 3px;
            color: #369;
            font-weight: 700;
            text-align: center;
        }


        .part1 .active {
            background: url('images/tip.png') no-repeat 0 -299px;
            color: #333;
            text-decoration: none;
        }


        .part2 {
            margin-left: 100px;
            margin-top: 6px;
            border: 1px solid lightcoral;
        }

        .part2 .active {
            color: #b4b4b4;
        }

        .part2 a {

            margin-left: 10px;
            color: #390;

        }

        .part3 {
            float: right;
            background-color: #84a42b;
            border: 1px solid #8aab30;
            color: #fff;
            height: 30px;
            line-height: 30px;
            text-align: center;
            width: 134px;
            font-size: 14px;
            margin-top: 10px;

        }


/*======content区域设置part2: article-list =====*/




        .article-list .item {

           padding-top: 10px;
           border-bottom: 1px solid #dce7f4;
            /*清除浮动*/
           /*overflow: hidden;*/
            }

        .item .news-pic {
            float: right;
            margin-top: 25px;
            width: 11%;
            border: 1px solid rebeccapurple;
            text-align: center;

        }

        .item .news-content{
            float: left;
            width: 87%;
            border: 1px solid darkcyan;
        }

        .news-pic img{
            width: 60px;
            height: 60px;
        }


        .news-content .content-text{
            line-height: 24px;
            margin-top: 20px;
            margin-left: 15px;


        }


        .news-content .content-text:hover a{
            text-decoration: underline;
        }

        .content-text a{
                font-size: 14px;
                color: #369;
                font-weight: 700;
        }
        .news-content .content-icon{
            padding-top: 6px;
            color: #ccc;
            margin-bottom: 12px;

        }

        .content-source{

            color: #b4b4b4;
            margin-left: 7px;
        }

/*==========content-icon 设置hand-icon=========*/

        .hand-icon {
            background: url("images/icon_18_118.png") no-repeat 0 0;
        }


        .content-icon .icon-recommend {
            display: inline-block;
            background-position: 0 -40px;
            width:  18px;
            height: 18px;
        }

        .content-icon .icon-recommend:hover{
            background-position: 0 -20px;
        }


        .content-icon .icon-discuss {
            display: inline-block;
            background-position: 0 -100px;
            width: 18px;
            height: 18px;
            vertical-align: -1px;
        }

        .content-icon .icon-discuss:hover{
            background-position: 0 -80px;
        }


        .content-icon .icon-collect {
            display: inline-block;
            background-position: 0 -160px;
            width: 18px;
            height: 18px;
        }

        .content-icon .icon-collect:hover{
            background-position: 0 -120px;
        }


         /*调节图标的位置*/

         .content-icon a {
            margin-left: 10px;
            color: #99aecb;
        }

        .content-icon b,.content-icon .time-into i,.share-site-to i {
            vertical-align: 4px;
            font-weight: 800;
        }


/*==========content-icon 设置share-site-to=========*/

        .share-site-to{
              float: right;
              display: none;
              margin-right: 10px;
                    }

        .share-site-to .share-icon a {
                background: url("images/share_icon.png") no-repeat 0 0;
                width: 13px;
                height: 13px;
                display: inline-block;
                margin-right: 2px;
                margin-top: 2px;
                opacity: .3;
            }



        .share-site-to .share-icon a.icon-sina {
            background-position: 0 -90px;
            width: 17px;
            height: 14px;
        }


        .share-site-to .share-icon a.icon-douban {
            background-position: 0 -105px;
        }

        .share-site-to .share-icon a.icon-qqzone {
            background-position: 0 -120px;
            width: 16px;
            height: 14px;
        }

        .share-site-to .share-icon a.icon-tenxun {
            background-position: 0 -136px;
        }

        .share-site-to .share-icon a.icon-renren {

            background-position: 0 -151px;

        }

        .share-site-to .share-icon a:hover{
                opacity: .9;
            }
        .item:hover .share-site-to{
            display: block;
        }

        .share-site-to .share-icon {
            vertical-align: 2px;
        }


        .content-icon .time-into .time-a{
                color: #e59373;
        }



        /*================================设置page样式====================*/

        .page-area  ul li{
            list-style: none;
            display: inline-block;

        }
        .page-area  ul li a,.current_page{

            list-style: none;
            display: inline-block;
            color: #369;
            padding: 10px 15px;
            border-radius: 15%;
            border: 1px solid #e1e1e1;
            margin-left: 3px;
        }

        .page-area{
            padding-top: 20px;
            padding-bottom: 10px;

        }


        .page-area ul li .current_page{
               border: none;
               font-weight: 800;
        }
        .page-area ul li a:hover{
               color: #fff;
               background-color: #2459a2;
            }

  /*==================================footer区域设置=================*/

        .footer-box{
        margin: 0 auto;
        width: 1020px;
        background-color: #fff;
        border-top:1px solid #dce7f4;;
        }

        .footer-box .foot-nav {
                padding-top: 15px;
                text-align: center;
                border-top: 1px solid #ccdcef;
                /*position: relative;*/
            }

        .footer-box .foot-nav2 {
            margin-top: 6px;
            margin-bottom: 15px;
            text-align: center;
        }

        .foot_b {
                color: #999;
                font-size: 12px;
            }



        .clearfix:after{
            display: block;
            content: "";
            clear: both;
        }


View Code