FrontEnd-Basis-4th

周日,雨,记录生活分享点滴

练习·抽屉页面

HTML文件

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

<!-------顶部盒子1----------------------------------------------------------------------------------->
<div class="head-box">
    
    <!-------顶部盒子1.1----------------------------------------------------------------------------->
    <div class="head-content">
        
        <!-------顶部盒子1.1.1----------------------------------------------------------------------->
        <a href="#" class="logo"></a>
        
        <!-------顶部盒子1.1.2----------------------------------------------------------------------->
        <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>
        </div>

        <!-------顶部盒子1.1.3----------------------------------------------------------------------->
        <div class="key-search">
                <form action="/" method="post"><!--因不作提交操作,action method暂时无意义-->
                    <input type="text" class="search-txt" autocomplete="off">
                    <a href="#" class="i" >
                        <span class="ico"></span>  <!--插入搜索图标-->
                    </a>
                </form>
        </div>
        
        <!-------顶部盒子1.1.4---------------------------------------------------------------------->
        <div class="action-nav">
                <a href="#" class="register-btn">注册</a>
                <a href="#" class="login-btn">登录</a>
        </div>

    </div>
</div>


<!-------主要盒子1----------------------------------------------------------------------------------->
<div class="main-content-box">
    
    <!-------主要盒子1.1----------------------------------------------------------------------------->
    <div class="main-content">
        
        <!-------主要盒子1.1.1--左边内容-------------------------------------------------------------->
        <div class="content-L">
            
            <!-------主要盒子1.1.1.1----------------------------------------------------------------->
            <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>
            
            <!-------主要盒子1.1.1.2--新闻内容摘要----------------------------------------------------->
            <div class="content-list">
                <!--新闻1-------->
                <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>

                                        </span>
                                    </span>

                                   </div>
                               </div>

                </div>


            <!-------主要盒子1.1.1.3--底部分页功能----------------------------------------------------->
            <div class="page-area">
                         <ul>
                             <li><span class="ct_pagepw">1</span></li>  <!--因为第一页不需要跳转,所以不用a标签-->
                             <li><a href="#" class="ct_pagepa">2</a></li>
                             <li><a href="#" class="ct_pagepa">3</a></li>
                             <li><a href="#" class="ct_pagepa">4</a></li>
                             <li><a href="#" class="ct_pagepa">5</a></li>
                             <li><a href="#" class="ct_pagepa">6</a></li>
                             <li><a href="#" class="ct_pagepa">7</a></li>
                             <li><a href="#" class="ct_pagepa">8</a></li>
                             <li><a href="#" class="ct_pagepa">9</a></li>
                             <li><a href="#" class="ct_pagepa">10</a></li>
                             <li><a href="#" class="ct_page_edge">下一页</a></li>
                         </ul>
            </div>
        </div>
        </div>
        <!-------主要盒子1.1.2--右边内容-------------------------------------------------------------->
        <div class="content-R">
        </div>

    </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="#" target="_blank" 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>


</body>
</html>

.CSS文件

/*------清除浏览器默认格式---------------------------------------------------------------------------*/
        *{                              /* 星号效率低,并不是所有都需要进行操作 */
            margin: 0;
            padding: 0;
        }

/* 对body, button, input, select, td, textarea a标签进行字体格式颜色的设定 */
        body, button, input, select, td, textarea a {
            font: 12px Tahoma,Verdana,Arial,Helvetica,"\5b8b\4f53",sans-serif;
            color: red;
        }

/*-------去除<a>标签的默认自带的下划线格式-------------------------------------------------------------*/
        a{
            text-decoration: none;
        }

/*-------设置body内所有字体大小----------------------------------------------------------------------*/
        body{
            font-size: 12px;
        }

/*-------顶部盒子1----------------------------------------------------------------------------------*/
         .head-box{
             background-color: #2459a2;
             height: 44px;
             width: 100%;
             position: fixed;
             top:0;                     /* 需要指定head-box的位置,0可以不加颜色,其他数值需要加 */
             left: 0;
             z-index: 1000;
         }

/*-------顶部盒子1.1--------------------------------------------------------------------------------*/
        .head-content{
            margin: 0 auto;             /* 使顶部盒子1.1居中 */
            width: 1016px;
            height: 44px;               /* 高度需要与顶部盒子1保持一致 */
            background-color: #2459a2;  /* 背景颜色需要与顶部盒子1保持一致 */
            line-height: 44px;          /* 设置行高:使顶部盒子1.1以下元素位置上下居中 */
            position: relative;
        }

/*-------顶部盒子1.1.1------------------------------------------------------------------------------*/
        .logo{
            background: url("images/logo.png") no-repeat 0 0;  /* 插入logo图片,位置不动(0,0) */
            height: 23px;               /* 图片默认大小为23*121px */
            width: 121px;
            float: left;
            margin-top: 11px;           /* 设置图片与周围元素的边距 */
            /*display: inline-block;*/  /* display与float的效果一样 */
        }

/*-------顶部盒子1.1.2------------------------------------------------------------------------------*/
        .action-menu{
            float: left;
            margin-left: 20px;
        }

        .action-menu a.tb{              /* a.tb指必须是class等于tb的a标签 */
            color: #c0cddf;
            margin-left: -8px;          /* 去除a标签本身的空隙,使a标签元素的间距为0 */
            padding: 0 13px 0 13px;     /* 设置内容与边框的距离 */
            display: inline-block;      /* 因为a是内联标签,由于需要padding调节宽度,所以用inline-block */
        }

        .action-menu a.tb:hover{        /* 通过伪类设置鼠标悬浮效果 */
            color: #fff;
            background-color: #c0cddf;
        }

        .action-menu a.active,.action-menu a.active:hover{  /* a.active指a标签在链接上按下鼠标时的状态,逗号后面的一句是指当鼠标悬浮时还是下面设置的效果,将上面设置的颜色进行了覆盖 */
                color: #fff;
                background-color: #204982;
        }

/*-------顶部盒子1.1.3------------------------------------------------------------------------------*/
        .key-search{                    /* 搜索盒子整体进行右浮动 */
            float: right;
            margin-top: 5px;
        }

        .key-search .search-txt,.key-search  a.i{    /* 搜索盒子内有两部分,文本框和搜索按钮整体向左浮动,进行排序 */
            float: left;
        }

        .key-search .search-txt{        /* 设置搜索文本框 */
            width: 91px;
            height: 25px;
            color: red;                 /* 输入字体的颜色 */
            padding: 2px 2px 2px 5px;
        }

        .key-search .ico{               /* 搜索图标 */
            background: url("images/icon.png") no-repeat 0 -197px;
            height: 12px;
            width: 15px;
            display: inline-block;
            margin-bottom: 6px;
            margin-left: 10px;
        }

        .key-search a.i{                /* 搜索图标框 */
             height: 32px;
             width: 30px;
             background-color: #f4f4f4;
             display: inline-block;
             border-left: none;         /* 因为默认有border,而左边已经在文本框中设置了(即文本框的右边),所以需要搜索图标框左边设置为0 */
        }

/*-------顶部盒子1.1.4------------------------------------------------------------------------------*/
         .action-nav{                   
             position: absolute;        /* 设置注册登录框绝对定位 */
             right: 131px;
         }
         .action-nav a{
             color: #fff;
             padding: 0 20px;
             display: inline-block;
         }
        .action-nav a:hover{
             background-color: #c0cddf;
        }

/*------------------------------------------head end-----------------------------------------------*/         


/*-------主要盒子1----------------------------------------------------------------------------------*/
        .main-content-box{
            background-color: gray;
            width: 100%;
            padding-top: 44px;          /* 避免被顶部覆盖掉 */
        }
/*-------主要盒子1.1--------------------------------------------------------------------------------*/
        .main-content{
            margin: 0 auto;             /* 居中 */
            background-color: #fff;
            overflow: hidden;           /* 当文本超出已设定的长度时会将其隐藏,继续向下滑动即显示出来,配合auto使用作自适应 */
            width: 960px;
            height: auto!important;     /* 根据内容自适应,!important防止被其他元素覆盖 */
            min-height: 700px;          /* 页面的最小高度是700,内容超过700然后自适应 */
            padding: 6px 28px 60px 28px;  /* 主要内容的边框 */
        }
/*-------主要盒子1.1.1--左边内容---------------------------------------------------------------------*/
        .content-L{
            float: left;
            width: 630px;
        }
/*-------主要盒子1.1.1.1----------------------------------------------------------------------------*/
        .child-nav,.sort-nav{           /* child-nav盒子和sort-nav盒子向左排序 */
            float: left;
            padding: 10px;
        }
        .publish-btn{                   /* publish-btn盒子向右排序 */
            float: right;
            padding: 10px;
        }

        .top-area{
            overflow: hidden;
            border-bottom: 1px solid red ;  /* 添加分割线 */
        }
        
        .child-nav .active{             /* 作特殊处理,其他的和其他标签一样 */
            background: url("images/tip.png") no-repeat 0 -299px;
            color: black;
        }
        .child-nav a{
            display: inline-block;
            width: 60px;
            height: 26px;
            line-height: 26px;          /* 保证字体垂直居中 */
            text-align: center;         /* 保证字体水平居中 */
            color: #369;
            font-weight: 700;           /* 设置字体的粗细 */
            margin-top: 3px;            /* 设置此顶部边距3px */
        }

        .sort-nav {                     /* 控制盒子与盒子之间的距离 */
            margin-left: 144px;
            margin-top: 10px;
        }
        .sort-nav .active{
            color: #b4b4b4;
        }
        .sort-nav a{
            margin-left: 10px;          /* 控制元素与元素之间的距离 */
            color: darkgreen;
        }

        .publish-btn{
            display: inline-block;
            width:80px;
            height: 18px;
            background-color: #84a42b;
            color: #fff;
            line-height: 18px;
            text-align: center;
        }

        /*--------------------------------end  top_area--------------------------------------------*/


/*-------主要盒子1.1.1.2--新闻内容摘要----------------------------------------------------------------*/
        .content-list .item{            /* 文本盒子 */
            border-bottom: 1px solid red ;  /* 添加分割线 */
            margin-top: 10px;
        }

        .item .news-pic{                /* 设置图片在右边 */
            float: right;
            margin-top: 3px;
            margin-left: 10px;
        }

        .part2{
            padding-top: 6px;
            color: #ccc;
            margin-bottom: 12px;
        }

        .hand-icon{                     /* 设置分享图标 */
            background: url("images/icon_18_118.png") no-repeat 0 0;  /* 三张图片 */
            width: 18px;
            height: 18px;
            display: inline-block;
            vertical-align: -4px;       /* 垂直居中,使图标与文本处于同一水平线上 */
        }
        .icon-recommend{
            background-position: 0 -40px;
        }
        .icon-discuss{
            background-position: 0 -100px;
        }
        .icon-collect{
            background-position: 0 -140px;
        }

         .part2 .user-a span{
            vertical-align: -4px;
        }
        .part2 a{
            margin-left: 7px;
        }

        .part1{
            line-height: 20px;
        }
        .part1 .content-source,.part1 .content-kind{
            color:#d4d4d4 ;
        }
        .part1 .content-kind{
            text-decoration: underline; /* 下划线 */
        }

        .part1 .show-content{
            font-size: 14px;
            color: #369;
            font-weight: 700;
        }

        .part2 b,.time-into i{          /* 设置part2的b标签和time-into的i标签下的元素 */
            color: #d4d4d4;
        }

        .share-icon a{
            background: url("images/share_icon.png");
            height: 14px;
            width: 17px;
            display: inline-block;
            vertical-align: -4px;
            opacity: 0.3;               /* 为图标设置透明度0.3 */ 
        }

        .share-site-to .share-icon a.icon-sina {
            background-position: 0 -90px;
        }
        .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{
            float: right;
        }

        .share-icon a:hover{
            opacity: 1;                 /* 为图标设置透明度1 */ 
        }

/*-------主要盒子1.1.1.3--底部分页功能----------------------------------------------------------------*/
        .page-area ul li,.ct_page_edge{
            display: inline-block;
            float: left;
            color: #369;
            height: 34px;
            line-height: 34px;
            text-align: center;
            width: 34px;
            border: 1px solid #e1e1e1;
            border-radius: 20%;         /* 矩形的角变成圆角 */
            margin-left: 3px;
        }
        .dig_lcpage{
            margin-left: 10px;
        }
        .ct_page_edge{                  /* 单独设置“下一页”的宽度 */
           width: 70px;
        }
        .page-area ul li:hover,.ct_page_edge:hover{
            color: #fff!important;
            background-color: #204982;
        }


/*-------底部盒子-----------------------------------------------------------------------------------*/
        .footer-box{
            background-color: #fff;
            clear: both;                /* 表示左边和右边都不能有浮动对象 */
        }
        .footer-box .foot-nav {
            padding-top: 15px;
            text-align: center;
            border-top: 1px solid #ccdcef;
            position: relative;
        }
        .footer-box .foot-nav2{
            text-align: center;
        }

猜你喜欢

转载自www.cnblogs.com/chungzhao/p/13200458.html
th