[H5]盒子模型的应用

[H5]盒子模型的应用

参照微博首页的削减结构,简单体验一下盒子模型的使用。

[index.html]

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>盒子模型的应用</title>
    <link rel="stylesheet" href="indexCSS.css">
</head>
<body>
    <!--整个页面的父容器-->
    <div id="superDivID">
        <!--header根容器-->
        <div id="headerDivID">
            <div class="headerViewClass">
                <h1>header</h1>
            </div>
        </div>
        <!--content根容器-->
        <div id="contentDivID">
            <!--nav-->
            <div class="navContainerClass">
                <h2>nav</h2>
            </div>
            <!--content-->
            <div class="contentContainerClass">
                <h2>content</h2>
            </div>
            <!--hot-->
            <div class="hotContainerClass">
                <h2>hot</h2>
            </div>
        </div>
        <!--footer根容器-->
        <div id="footerDivID">
            <div class="footerViewClass">
                <table>
                    <tr>
                        <td>
                            <ul>
                                <li>早餐</li>
                                <li>午餐</li>
                                <li>晚餐</li>
                            </ul>
                        </td>
                        <td>
                            <ol>
                                <li>鸡蛋</li>
                                <li>抄手</li>
                                <li>牛肉</li>
                            </ol>
                        </td>
                        <td>
                            <img class="QRCodeImgClass" src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=52961750,4241917740&fm=27&gp=0.jpg">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</body>
</html>

[indexCSS.css]

/*使用通配符取消所有标签的内边距&外边距*/
*{
    /*内边距*/
    padding: 0px;
    /*外边距*/
    margin: 0px;
}

#superDivID{
    width: 100%;
    height: 1000px;
    background-color: gray;
}

/*header*/
#headerDivID{
    width: 100%;
    height: 50px;
    background-color: blue;
}
.headerViewClass{
    width: 80%;
    height: 100%;
    background-color: red;
    /*上下外边距为0px 左右为自适应*/
    margin: 0px auto;
}
.headerViewClass h1{
    text-align: center;
}

/*content*/
#contentDivID{
    width: 80%;
    height: 850px;
    background-color: green;
    margin: 0px auto;
}
.navContainerClass{
    width: 10%;
    height: 100%;
    background-color: blueviolet;
    float: left;
}
.contentContainerClass{
    width: 70%;
    height: 100%;
    background-color: blue;
    float: left;
}
.hotContainerClass{
    width: 20%;
    height: 100%;
    background-color: yellow;
    float: left;
}

/*footer*/
#footerDivID{
    width: 100%;
    height: 100px;
    background-color: blue;
}
.footerViewClass{
    width: 80%;
    height: 100%;
    background-color: red;
    margin: 0px auto;
}
.footerViewClass table{
    width: 100%;
    height: 100%;
    /*表格边框*/
    border: 1px solid black;
    /*边框塌陷*/
    border-collapse: collapse;
    text-align: center;
}
.footerViewClass td{
    width: 33.3333%;
    border: 1px solid black;
}
.QRCodeImgClass{
    width: 80px;
    height: 80px;
}

原型:


结构:

效果:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值