Html 如何正确清理这些浮动div?
我以为我理解了用CSS进行ClearFixed的Html 如何正确清理这些浮动div?,html,css,clearfix,Html,Css,Clearfix,我以为我理解了用CSS进行ClearFixed的:之后的方法,但我似乎无法让它正常工作。出于某种原因,包含浮动元素的按钮容器后面的同级容器似乎没有清除 HTML: 小提琴: 也可以通过清除父dic而不是子dic来完成 而不是 .buttonContainer div:last-child:after { content: ""; display: block; clear: both; } 使用 这和我的一样,对吗?好的,那么您正在向最后一个孩子添加clearfix!很好。@Pra
:之后的方法,但我似乎无法让它正常工作。出于某种原因,包含浮动元素的按钮容器
后面的同级容器
似乎没有清除
HTML:
小提琴:
也可以通过清除父dic而不是子dic来完成
而不是
.buttonContainer div:last-child:after {
content: "";
display: block;
clear: both;
}
使用
这和我的一样,对吗?好的,那么您正在向最后一个孩子添加clearfix!很好。@PraveenKumar现在和你的一样,但不是我发布Lolook的时候。当然<代码>:)
这就是我要找的,谢谢!还有-我接受这个答案是因为@PraveenKumar第一次发布他的第一个答案不是我想要的,他在发布这个答案后改变了答案。@jessikwa是的,那很好。但我没有抄。顺便提一下
.action_button {
font-family: Arial;
font-size: 9pt;
font-weight: bold;
background-color: #f2c059;
color: white;
border-radius: 5px;
display: inline-block;
padding: 5px;
cursor: pointer;
}
.buttonContainer {
margin: 5px;
}
.buttonContainer div {
margin: 0 5px;
float: right;
}
.buttonContainer div:last-child:after {
content: "";
display: block;
clear: both;
}
.siblingContainer {
height: 500px;
background: gray;
}
.buttonContainer div:last-child:after {
content: "";
display: block;
clear: both;
}
.buttonContainer:after {
content: "";
display: block;
clear: both;
}