《CSS设计彻底研究》第3章/09.htm p69代码

来源:互联网 发布:物业管理系统php源码 编辑:程序博客网 时间:2024/06/05 11:10

<head>
    <title>设置父块的高度</title>
    <style type="text/css">
div.father { /*父div*/
    background-color: #fffebb;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    padding: 10px;
    border: 1px solid #000000;
    height:40px;        /*设置父块的高度*/
}

div.son {
    background-color: #a2d2ff; /*子div*/
    margin-top: 30px;
    margin-button: 0px;
    padding: 15px;
    border: 1px dashed #004993;
}
</style>
</head>
<body>
    <div class="father">
        <div class="son">
            子div
        </div>
    </div>
</body>

 

效果: