Blogger Information
Blog 16
fans 1
comment 0
visits 14165
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2019年7月4日作业(一) -写一个盒子
杜强_上海_315106编程学习
Original
665 people have browsed it

以下代码为建设一个盒模型:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="static/css/style1.css">
    <title>建立一个盒模型</title>
</head>
<body>
<div class="box1"></div>
<div class="box2">
    <div class="box3"></div>
</div>
</body>
</html>
.box1 {
    width: 200px;
    height: 200px;
    background-color: red;
}

.box1{
    padding: 20px;
    margin: 30px;
}

.box1{
    border-top: 5px solid blue;
    border-left: 5px solid blue;
    border-bottom: 5px solid blue;
    border-right: 5px solid blue;
}



.box2 {
    width: 200px;
    height: 200px;
    background-color: red;
}

.box2{
    padding: 20px;
    margin: 30px;
}

.box2{
    border: 5px solid green;
}

.box3 {
    /*width: 200px;*/
    height: 200px;
    background-color: blue;
}

以上代码执行结果截图:

0704-1.png

总结:学完和模型的运用,应该注意以下几点:

  1. 盒模型的css代码简写

  2. 子盒子只能继承父盒子的宽度,其他都不能继承!

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