标签:ber contain add and padding -- pair utf-8 nta
clear : right; 右侧不允许有浮动元素
clear : left; 左侧不允许有浮动元素
clear : both; 两侧不允许有浮动元素
clear : none;
#box{
width: 1500px;
height: 500px;
border: 2px solid red;
}
<div class="clear"></div>
.clear{
clear: both;
margin: 0;
padding: 0;
}
#box{
border: 2px solid red;
/*超出部分 overflow: scroll滚动条 hidden隐藏*/
overflow: hidden;
}
#box:after{
content: ‘‘;
display: block;
clear: both;
}
使用空div和伪类after就不要设宽高了
html:
css:
#box{
border: 2px solid red;
/*超出部分 overflow: scroll滚动条 hidden隐藏*/
/*overflow: hidden;*/
}
?
#box:after{
content: ‘‘;
display: block;
clear: both;
}
?
div{
border: 2px solid red;
}
?
div:nth-of-type(1){
display: inline-block;
float: left;
}
?
div:nth-of-type(2){
display: inline-block;
float: left;
height: 500px;
}
?
div:nth-of-type(3){
display: inline-block;
float: left;
}
?
p{
display: inline-block;
border: 2px solid red;
float: left;
/*
clear : right; 右侧不允许有浮动元素
clear : left; 左侧不允许有浮动元素
clear : both; 两侧不允许有浮动元素
clear : none;
*/
/*clear: none;*/
?
}
?
/*.clear{
clear: both;
margin: 0;
padding: 0;
}*/
标签:ber contain add and padding -- pair utf-8 nta
原文地址:https://www.cnblogs.com/qqyzml/p/14939488.html