网页实战

index.html 代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS 网页布局实战</title>
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
    <!-- 头部 -->
    <div class="header">
        <div><img class="logo" src="image/logo.png" alt="logo"></div>
        <div class="nav">
            <ul>
                <li>首页</li>
                <li>图片</li>
                <li>视频</li>
                <li>笔记</li>
            </ul>
        </div>
    </div>
    <!-- 主体 -->
    <div class="main">
        <div class="top">
            <img src="image/1.jpeg">
        </div>
        <!-- 遮罩层 -->
        <div class="topLayer"></div>
        <!-- 最上层内容 -->
        <div class="topLayer-top"> 
            <div class="word">MY BEAUTIFUL LIFE</div>
            <button>LOOK NORE &gt;</button>
        </div>
        <!-- 中间部分 -->
        <div class="middle">
            <div class="m-top">
                <div class="commen weibo">
                    <img src="image/weibo.png">
                    <div>MICROBOLG</div>
                </div>
                <div class="commen weixin">
                    <img src="image/weixin.png">
                    <div>WECHAT</div>
                </div>
                <div class="commen qq">
                    <img src="image/QQ.png">
                    <div>QQ</div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="m-middle">
                "I want to give good things to record down,</br>after the recall will be very beautiful."
            </div>
            <div class="m-bottom">
                <div class="commen first">
                    <img src="image/03-01.jpg">
                    <div class="dest1">Cool Image</div>
                    <div class="dest2">Record The Picture</div>
                </div>
                <div class="commen second">
                    <img src="image/03-02.jpg">
                    <div class="dest1">Cool Image</div>
                    <div class="dest2">Record The Picture</div>
                </div>
                <div class="commen third">
                    <img src="image/03-03.jpg">
                    <div class="dest1">Cool Image</div>
                    <div class="dest2">Record The Picture</div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <!-- 底部部分 -->
        <div class="bottom">
            <div class="content">
                <div class="title">
                    FROM THE PHOTO ALBUM
                </div>
                <div class="pic-content">
                    <!-- 图文混排 -->
                    <dl>
                        <dt><img src="image/04-01.jpg"></dt>
                        <dd class="word">Life is like a book, just read more and more refined, more write more carefully. When read, mind open, all things have been indifferent to heart. Life is the precipitation.
                        </dd>
                    </dl>
                    <dl>
                        <dt><img src="image/04-02.jpg"></dt>
                        <dd class="word">Life is like a cup of tea, let people lead a person to endless aftertastes. You again good taste, it will always have a different taste, different people will have different taste more.</dd>
                    </dl>
                    <div class="clear"></div>
                </div>
            </div>
        </div>

    </div>
    <!-- 底部 -->
    <div class="footer">
        © 2016 onexzb.cn 京ICP备13046642号
    </div>
</body>
</html>

index.css 代码:

* {
    margin: 0px;
    padding: 0px;
}

.header {
    width: 100%;
    height: 100px;
}

.header img {
    width: 300px;
    height: 85px;
    margin-top: 8px;
    margin-left: 100px;
}

.header .logo {
    float: left;
}

.header .nav {
    float: right;
}

.header .nav ul {
    padding-right: 100px;
}

.header .nav ul li{
    float: left;
    list-style: none;
    width: 80px;
    height: 100px;
    line-height: 100px;
    font-size: 15px;
    font-weight: bolder;
    color: #7D7D7D;
}

.main .top img {
    width: 100%;
    height: 600px;
}

.main .topLayer{
    position: absolute;
    left: 0px;
    top: 100px;
    width: 100%;
    height: 600px;
    background: #000;
    opacity: 0.5;
}

.main .topLayer-top {
    width: 500px;
    height: 300px;
    /*设置蓝色辅助背景*/
    /*background-color: blue;*/
    position: absolute;
    top: 400px;
    margin-top: -150px;
    right: 50%;
    margin-right: -250px;
}

.main .topLayer-top .word{
    padding-top: 100px;
    color: #fff;
    font-size: 45px;
    font-weight: bolder;
    text-align: center;
    font-family: "微软雅黑";
}

.main .topLayer-top button{
    width: 200px;
    height: 60px;
    margin-top: 50px;
    color: #fff;
    background-color: #F5704F;
    font-family: "微软雅黑";
    /*字体在中央显示*/
    text-align: center;
    /*设置粗体*/
    font-weight: bolder;
    font-size: 14px;
    /*设置圆角*/
    border-radius: 8px;
    /*设置水平居中*/
    margin-left: 150px;
}

.main .middle{
    width: 1000px;
    /*居中显示*/
    margin: 0 auto;
}

.main .middle .m-top .commen{
    float: left;
    width: 33.3%;
    padding-top: 50px;
    /*居中显示*/
    text-align: center;
}
.main .middle .m-top .commen img{
    width: 100px;
    height: 100px;
}

.main .middle .m-top .commen div{
    /*width: 60px;
    height: 100px;*/
    /*字体样式*/
    font-family: "微软雅黑";
    /*字体加粗*/
    font-weight: bold;
    /*字体大小*/
    font-size: 20px;
    /*字体颜色*/
    color: #7D7C7F;
    /*设置距离*/
    padding-top: 20px;
}

.main .middle .m-middle{
    font-size: 22px;
    color: #E19796;
    /*加粗*/
    font-weight: bold;
    /*距离顶部*/
    padding-top: 50px;
    /*设置斜体*/
    font-style: italic;
    /*字体居中*/
    text-align: center;
    /*距离底部一定距离*/
    padding-bottom: 50px;
}

.clear{
    /*清除浮动,否则会影响*/
    clear: both;
}

.main .middle .m-bottom .commen{
    padding: 10px;
    float: left;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.main .middle .m-bottom .commen img{
    width: 310px;
    height: 250px;
}

.main .middle .m-bottom .commen .dest1{
    color: #7D7C7F;
    padding-top: 20px;
}

.main .middle .m-bottom .commen .dest2{
    padding-top: 10px;
    color: #BDBDBC;
}

.main .bottom{
    background-color: #F9F9F9;
}

.main .bottom .content{
    width: 1000px;
    margin: 0 auto;
}

.main .bottom .content .title{
    text-align: center;
    color: #7D7C7F;
    font-family: "微软雅黑";
    font-weight: bolder;;
    padding-top: 30px;
    font-size: 30px;
}
.main .bottom .content .pic-content dl{
    float: left;
    width: 470px;
    margin: 10px;
}

.main .bottom .content .pic-content dl dt img{
    width: 470px;
    height: 460px;
}

.main .bottom .content .pic-content dl .word{
    padding-top: 20px;
    font-size: 20px;
    font-weight: bold;
    color: #7D7C7F;
    padding-bottom: 50px;
}

.footer{
    width: 100%;
    height: 100px;
    background-color: #292C35;
    color: #ffffff;
    font-size: 15px;
    font-family: "微软雅黑";
    text-align: center;
    line-height: 100px;
}
最后修改:2019 年 05 月 02 日 03 : 47 AM

发表评论