前端頁面佈局練習

<!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-box樣式設置部分----- */
        .head-box{
            background-color: blue;
            height: 44px;
            width: 100%;
            position: fixed;
            top: 0;
            left: 0;
        }
        .head-content{
            width: 1016px;
            background-color: darkblue;
            height: 44px;
            line-height: 44px;
            margin: 0 auto;       /*margin設置auto就是居中*/
            position: relative;  /*父設置relative,子設置absolute,就以父爲參照物*/
        }
        .head-content .logo{
            display: inline-block;
            background: url("images/logo.png");
            background-repeat: no-repeat;
            width: 101px;
            height: 33px;
            float: left;
            margin-top: 5px;
        }
        .head-content .action-menu{
            float: left;
            margin-left: 20px;
        }
        .head-content .action-menu a.tb{
            display: inline-block;
            margin: -2px;
            /*border: 1px red solid;*/
            padding: 0 16px 0 13px;
            color: aquamarine;
        }
        .head-content .action-menu a.tb:hover{
            color: white;
            background-color: indigo;
        }
        .key-search{
            float: right;
            margin-top: 5px
        }
        .key-search .search-txt{
            float: left;
            width: 121px;
            height: 25px;
            padding: 2px 2px 2px 5px;
        }
        .key-search a{
            display: inline-block;
            width: 31px;
            height: 33px;
            background-color: white;
        }
        .key-search a span.ico{
            display: inline-block;
            width: 31px;
            height: 33px;
            background: url("images/ico.png") no-repeat -2px;/*找到一個圖片中的某一段*/

        }
        .action-nav{
            position: absolute;   /*作過定位後,內聯標籤就能夠設置長寬,而不用display*/
            right: 200px;
        }
        .action-nav a{
            display: inline-block;
            color: white;
            padding: 0 10px;
            margin: 0 5px;
        }
        .action-nav a:hover{
            background-color: indigo;
        }
        /*head-box樣式設置結束*/

        /*content樣式設置開始*/
        .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: 3px;
            margin-bottom: 5px;
        }

        .content-L .top-area{
            border-bottom: 1px solid gray;
            height: 40px;
            /*float: left;*/
        }
        .top-area .child-nav{
            float: left;
        }
        .top-area .child-nav a{
            display: inline-block;
            width: 60px;
            height: 26px;
            line-height: 26px;
            color: darkolivegreen;
            text-align: center;
            margin-left: 5px;
        }
        .top-area .child-nav .active{
            background: url("images/tip.png") no-repeat 0 -299px;
            color: black;
            font-weight: bolder;
        }
        .sort-nav{
            float: left;
            margin-left: 150px;
            margin-top: 7px;
        }
        .sort-nav a{
            display: inline-block;
            text-align: center;
            color: #339900;
            margin-left: 10px;
        }
        .publish-btn{
            float: right;
            display: inline-block;
            width: 136px;
            height: 32px;
            background-color: #84a42b;
            text-align: center;
            line-height: 32px;
            color: white;
        }

        .content-list .item{
            margin-left: 5px;
            margin-top:3px;
            border-bottom: 1px solid #b4b4b4;
        }
        .content-list .item .part1{
            line-height: 20px;
        }
        .content-list .item .part1:hover a.show-content{
            text-decoration: underline;
        }
        .content-list .item .part2{
            padding: 10px 0;
            color: #99aecb;
        }
        .part2 .hand-icon{
            background: url("images/icon_18_118.png") no-repeat 0 0;
            display: inline-block;
            width: 18px;
            height: 18px;
            margin-left: 8px;
        }
        .part2 .icon-recommend{
            background-position: 0 -40px;
        }
        .part2 .icon-recommend:hover{
            background-position: 0 -20px;
        }
        .part2 .icon-discuss{
            background-position: 0 -100px;
        }
        .part2 .icon-discuss:hover{
            background-position: 0 -80px;
        }
        .part2 .icon-collect{
            background-position: 0 -160px;
        }
        .part2 .icon-collect:hover{
            background-position: 0 -140px;
        }
        .part2 a b,.part2 span i{
            vertical-align: 4px;    /*豎直方向的對齊*/
            font-size: 14px;
        }
        .share-site-to .share-icon a{
            display: inline-block;
            background: url("images/share_icon.png") no-repeat 0 0;
            opacity: .3;
        }
        .share-icon a.icon-sina{
            background-position: 0 -91px;
            width: 17px;
            height: 14px;
        }
        .share-icon a.icon-douban{
            background-position: 0 -105px;
            width: 17px;
            height: 14px;
        }
        .share-icon a.icon-qqzone{
            background-position: 0 -121px;
            width: 17px;
            height: 14px;
        }
        .share-icon a.icon-tenxun{
            background-position: 0 -136px;
            width: 17px;
            height: 14px;
        }
        .share-icon a.icon-renren{
            background-position: 0 -151px;
            width: 17px;
            height: 14px;
        }
        .share-site-to{
            display: none;      /*讓內容不顯示*/
        }
        .item:hover .share-site-to{
            display: inline-block;
        }
        .share-site-to .share-icon a:hover{
            opacity: 1;          /*調整透明度*/
        }

        .page-area ul li{
            display: inline-block;
        }
        .page-area ul li a{
            display: inline-block;
            width: 32px;
            height:32px;
            line-height: 32px;
            color: #369;
            margin-left: 5px;
            text-align: center;
        }
        .page-area ul li a.page-next{
            width: 90px;
        }
        .page-area ul li a:hover{
            background-color: #cbeed8;
        }
        .page-area{
            margin-left: 60px;
        }

        .main-content .content-R{
            float: left;
        }
        .main-content .footer-box{
            clear: both;
            margin: 0 auto;
            width: 960px;
            background-color: #fff;
            border: 1px solid #dec7f4;
        }


    </style>
</head>
<body>

<div class="head-box">
    <div class="head-content">
        <a href="#" class="logo"></a>
        <div class="action-menu">
            <a href="#" class="tb action">所有</a><!--名字中間加空格,表示他有兩個名字-->
            <a href="#" class="tb">熱點</a>
            <a href="#" class="tb">段子</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="i">
                    <span class="ico"></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">24h</a>
                    <a href="#" class="newbtn">3days</a>
                </div>

                <a href="#" class="publish-btn">
                    <span class="n2">發佈</span>
                </a>

            </div>

            <div class="content-list">

                <div class="item">
                    <div class="new-pic">
                        <img src="images/news.png"></img>
                    </div>
                    <div class="new-content">
                        <div class="part1">
                            <a href="#" class="show-content" target="_blank">
                                    國家住建部日前宣佈,包括杭州、寧波在內的46個城市將在2020年末前,做爲先行先試的重點城市,基本建成垃圾分類處理系統。
                                上海居民們目前經受的「靈魂拷問」,或許很快就是明天的你我要面對的。根據官方分類,生活垃圾主要分爲幹垃圾、溼垃圾、可回收物、有害垃圾。比對着平常垃圾分類表格,咱們把最新的分類垃圾桶放在面前,一個垃圾桶被隔成兩格,格子外面分別印着幹垃圾和溼垃圾。
                                菜葉菜梗等蔬果殘餘以及未食用完的蛋糕都屬於溼垃圾,第一感官是溼的,基本能夠直接歸到溼垃圾,也包括蟹殼和蝦殼。
                                照着單子,像餅乾、花生殼、瓜子殼、蛋殼等,都屬於溼垃圾,雖然看上去它們是乾的.看上去和蟹殼蝦殼很接近的貝殼是溼垃圾嗎?咱們一比對,貝殼屬於幹垃圾。吃剩下的桃核、西梅核,也是幹垃圾行列.
                            </a>
                            <span class="content-source">www.baidu.com</span>
                            <a href="#" class="n2">
                                <span class="content-kind">熱點</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>
                            <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="new-pic">
                        <img src="images/news.png"></img>
                    </div>
                    <div class="new-content">
                        <div class="part1">
                            <a href="#" class="show-content" target="_blank">
                                國家住建部日前宣佈,包括杭州、寧波在內的46個城市將在2020年末前,做爲先行先試的重點城市,基本建成垃圾分類處理系統。
                                上海居民們目前經受的「靈魂拷問」,或許很快就是明天的你我要面對的。根據官方分類,生活垃圾主要分爲幹垃圾、溼垃圾、可回收物、有害垃圾。比對着平常垃圾分類表格,咱們把最新的分類垃圾桶放在面前,一個垃圾桶被隔成兩格,格子外面分別印着幹垃圾和溼垃圾。
                                菜葉菜梗等蔬果殘餘以及未食用完的蛋糕都屬於溼垃圾,第一感官是溼的,基本能夠直接歸到溼垃圾,也包括蟹殼和蝦殼。
                                照着單子,像餅乾、花生殼、瓜子殼、蛋殼等,都屬於溼垃圾,雖然看上去它們是乾的.看上去和蟹殼蝦殼很接近的貝殼是溼垃圾嗎?咱們一比對,貝殼屬於幹垃圾。吃剩下的桃核、西梅核,也是幹垃圾行列
                            </a>
                            <span class="content-source">www.baidu.com</span>
                            <a href="#" class="n2">
                                <span class="content-kind">熱點</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>
                            <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="new-pic">
                        <img src="images/news.png"></img>
                    </div>
                    <div class="new-content">
                        <div class="part1">
                            <a href="#" class="show-content" target="_blank">
                                國家住建部日前宣佈,包括杭州、寧波在內的46個城市將在2020年末前,做爲先行先試的重點城市,基本建成垃圾分類處理系統。
                                上海居民們目前經受的「靈魂拷問」,或許很快就是明天的你我要面對的。根據官方分類,生活垃圾主要分爲幹垃圾、溼垃圾、可回收物、有害垃圾。比對着平常垃圾分類表格,咱們把最新的分類垃圾桶放在面前,一個垃圾桶被隔成兩格,格子外面分別印着幹垃圾和溼垃圾。
                                菜葉菜梗等蔬果殘餘以及未食用完的蛋糕都屬於溼垃圾,第一感官是溼的,基本能夠直接歸到溼垃圾,也包括蟹殼和蝦殼。
                                照着單子,像餅乾、花生殼、瓜子殼、蛋殼等,都屬於溼垃圾,雖然看上去它們是乾的.看上去和蟹殼蝦殼很接近的貝殼是溼垃圾嗎?咱們一比對,貝殼屬於幹垃圾。吃剩下的桃核、西梅核,也是幹垃圾行列
                            </a>
                            <span class="content-source">www.baidu.com</span>
                            <a href="#" class="n2">
                                <span class="content-kind">熱點</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>
                            <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="new-pic">
                        <img src="images/news.png"></img>
                    </div>
                    <div class="new-content">
                        <div class="part1">
                            <a href="#" class="show-content" target="_blank">
                                國家住建部日前宣佈,包括杭州、寧波在內的46個城市將在2020年末前,做爲先行先試的重點城市,基本建成垃圾分類處理系統。
                                上海居民們目前經受的「靈魂拷問」,或許很快就是明天的你我要面對的。根據官方分類,生活垃圾主要分爲幹垃圾、溼垃圾、可回收物、有害垃圾。比對着平常垃圾分類表格,咱們把最新的分類垃圾桶放在面前,一個垃圾桶被隔成兩格,格子外面分別印着幹垃圾和溼垃圾。
                                菜葉菜梗等蔬果殘餘以及未食用完的蛋糕都屬於溼垃圾,第一感官是溼的,基本能夠直接歸到溼垃圾,也包括蟹殼和蝦殼。
                                照着單子,像餅乾、花生殼、瓜子殼、蛋殼等,都屬於溼垃圾,雖然看上去它們是乾的.看上去和蟹殼蝦殼很接近的貝殼是溼垃圾嗎?咱們一比對,貝殼屬於幹垃圾。吃剩下的桃核、西梅核,也是幹垃圾行列
                            </a>
                            <span class="content-source">www.baidu.com</span>
                            <a href="#" class="n2">
                                <span class="content-kind">熱點</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>
                            <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="new-pic">
                        <img src="images/news.png"></img>
                    </div>
                    <div class="new-content">
                        <div class="part1">
                            <a href="#" class="show-content" target="_blank">
                                國家住建部日前宣佈,包括杭州、寧波在內的46個城市將在2020年末前,做爲先行先試的重點城市,基本建成垃圾分類處理系統。
                                上海居民們目前經受的「靈魂拷問」,或許很快就是明天的你我要面對的。根據官方分類,生活垃圾主要分爲幹垃圾、溼垃圾、可回收物、有害垃圾。比對着平常垃圾分類表格,咱們把最新的分類垃圾桶放在面前,一個垃圾桶被隔成兩格,格子外面分別印着幹垃圾和溼垃圾。
                                菜葉菜梗等蔬果殘餘以及未食用完的蛋糕都屬於溼垃圾,第一感官是溼的,基本能夠直接歸到溼垃圾,也包括蟹殼和蝦殼。
                                照着單子,像餅乾、花生殼、瓜子殼、蛋殼等,都屬於溼垃圾,雖然看上去它們是乾的.看上去和蟹殼蝦殼很接近的貝殼是溼垃圾嗎?咱們一比對,貝殼屬於幹垃圾。吃剩下的桃核、西梅核,也是幹垃圾行列
                            </a>
                            <span class="content-source">www.baidu.com</span>
                            <a href="#" class="n2">
                                <span class="content-kind">熱點</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>
                            <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 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>
            </div>
            <a href="#"  style="margin-left:0;vertical-align:-2px;">
                <img src="images/ct_rss.gif" width="36" height="14">
            </a>
        </div>

    </div>
</div>
</body>
</html>
相關文章
相關標籤/搜索