<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link type="text/css" href="css/tb.css" rel="stylesheet">
<style>
.father {
width: 100%;
border: 10px solid #5374d7;
margin: 0 auto;
height: 100px;
box-sizing: border-box;
}
.inner-box {
width: 100px;
border: 10px solid #5374d7;
height: 100px;
position: relative;
right : 0;
bottom: 0;
box-sizing: border-box;
}
.father div {
float: left;
width: 100px;
height: 100px;
}
.son1{
background: #a11411;
position: relative;
right: 0;
bottom: 0;
}
.son2{
background: #5374d7;
}
.son3{
background: #000000;
}
</style>
<!--
0.默认块级元素:<div> <p> <table> <span style="display:block">
1.margin: 容器之间的距离
2.padding: 内容与边框之间的距离
3.box-sizing:border-box / content-box
-border-box:height/width = border + padding + content
-content-box:height/width = content
4.两个div在同一个地方的margin会重叠,大的覆盖小的
5.两个div在同一个地方的margin和padding不会重叠
-->
<!--
(1)float:left|right 使div脱离标准流,浮动在某一个方向
(2)clear: left|right|both 取消div在某一方向的浮动
(3)注意:取消浮动使div变成inline-block(没有脱离标准流,但不换行)
(4)浮动的div之间的margin不会重叠
(5) 掌握javascript基础
-->
</head>
<body >
<div class="father">
<div class="son1"></div>
<div class="son2"></div>
<div class="son3"></div>
<p style="clear: both"></p>
</div>
</body>
</html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link type="text/css" href="css/tb.css" rel="stylesheet">
<style>
.father {
width: 100%;
border: 10px solid #5374d7;
margin: 0 auto;
height: 100px;
box-sizing: border-box;
}
.inner-box {
width: 100px;
border: 10px solid #5374d7;
height: 100px;
position: relative;
right : 0;
bottom: 0;
box-sizing: border-box;
}
.father div {
float: left;
width: 100px;
height: 100px;
}
.son1{
background: #a11411;
position: relative;
right: 0;
bottom: 0;
}
.son2{
background: #5374d7;
}
.son3{
background: #000000;
}
</style>
<!--
0.默认块级元素:<div> <p> <table> <span style="display:block">
1.margin: 容器之间的距离
2.padding: 内容与边框之间的距离
3.box-sizing:border-box / content-box
-border-box:height/width = border + padding + content
-content-box:height/width = content
4.两个div在同一个地方的margin会重叠,大的覆盖小的
5.两个div在同一个地方的margin和padding不会重叠
-->
<!--
(1)float:left|right 使div脱离标准流,浮动在某一个方向
(2)clear: left|right|both 取消div在某一方向的浮动
(3)注意:取消浮动使div变成inline-block(没有脱离标准流,但不换行)
(4)浮动的div之间的margin不会重叠
(5) 掌握javascript基础
-->
</head>
<body >
<div class="father">
<div class="son1"></div>
<div class="son2"></div>
<div class="son3"></div>
<p style="clear: both"></p>
</div>
</body>
</html>