HTML/Html-Css/06-盒模型.html
2023-05-01 19:37:40 +08:00

72 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width-device-width,initial-scale=1.0">
<title>盒模型 </title>
<style>
#app {
/* 盒子的大小
宽:
块:没设置宽 默认时父盒子宽
行:没有设置宽 默认时类容宽
高:
块,行 都一样,有内容决定发宽高 ,且无法设置宽高的
*/
width: 100px;
height: 100px;
background-color: salmon;
/* 内边距
会改变原有盒子的大小
*/
/* padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px; */
/* 边框
会改变原有盒子的大小
*/
/* border: style color width; */
border: solid pink 20px;
/* border-top-style: dashed;
border-top-width: 6px;
border-top-color: orangered; */
/* 外边框
盒子和盒子之间的额距离
块:
上下的margin会重合,如果一大一小(以大的为主)
行:margin 不会重合
*/
margin-top: 100px;
margin-bottom: 100px;
}
</style>
</head>
<body>
<div id="app">
</div>
<div id="app">
</div>
<div id="app">
</div>
</body>
</html>