Blogger Information
Blog 38
fans 1
comment 0
visits 24336
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4月25日作业简单盒子模型
鲨鱼辣椒的博客
Original
535 people have browsed it

写一个盒模型的简单案例,体会padding/border的简写规则

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简单css盒子模型</title>
</head>
    <style type="text/css">
        *{
            padding: 0px;
            margin: 0px;
        }
        ul{
            list-style:none ;
        }
        .clear{
            clear:both;
        }
        /*顶部*/
        #top{
            width: 980px;
            height: 300px;
            margin: 0px auto;
            background-color: chartreuse;
            border: 1px solid black;
        }

        .box{
            width: 350px;
            height: 280px;
            margin: 15px auto;
            padding: 10px auto;
            background-color: wheat;
            border: 3px solid red;
            border-radius: 130px;
        }

        p{
            width: 280px;
            height: 150px;
            margin: 50px auto;
            border: 1px solid cornflowerblue;
        }

        /*主体main*/
        #main{
            width: 1200px;
            height: 500px;
            margin: 0px auto;
            background-color: blue;
            border: 2px solid black;
        }
        #footer{
            width: 100%;
            height: 300px;
            margin: 20px 0px;
            background-color: palegreen;
            border: 2px solid brown;
        }
    </style>
<body>
    <!--顶部top-->
    <div id="top">
        <div class="box">
            <p>
                <b>
                你看这个盒它又长又宽,<br>
                就像你的头它又圆又亮,<br>
                你们,来这里学代码,<br>
                觉得,头好凉,我看行,<br>
                你们,来这里,敲代码,<br>
                就像我给你们剃头一样开心!!!!!
                </b>
            </p>
        </div>
    </div>

    <!--主体main-->
    <div id="main">
        <div class="box">
            <p>
                <b>
                    你看这个盒它又长又宽,<br>
                    就像你的头它又圆又亮,<br>
                    你们,来这里学代码,<br>
                    觉得,头好凉,我看行,<br>
                    你们,来这里,敲代码,<br>
                    就像我给你们剃头一样开心!!!!!
                </b>
            </p>
        </div>
    </div>

    <!--底部footer-->
    <div id="footer">
        <div class="box">
            <p>
                <b>
                    你看这个盒它又长又宽,<br>
                    就像你的头它又圆又亮,<br>
                    你们,来这里学代码,<br>
                    觉得,头好凉,我看行,<br>
                    你们,来这里,敲代码,<br>
                    就像我给你们剃头一样开心!!!!!
                </b>
            </p>
        </div>
    </div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post