:after
选择器实现这一目标?
CSS
div{
background:#59c;
box-sizing: border-box;
height: 100px;
width: 100%;
position: relative;
}
div:after{
background:#b55;
content: "I SHOULD BE AFTER CONTENT BOX";
width: 100%;
display:block;
}
答案 0 :(得分:3)
您可以对伪元素使用绝对定位:
<强> DEMO 强>
div:after{
position:absolute; /* <-- add this */
top:100%; /* <-- and this */
background:#b55;
content: "I SHOULD BE AFTER CONTENT BOX";
width: 100%;
display:block;
}
答案 1 :(得分:1)
这将按预期工作:
div {
background:#59c;
box-sizing: border-box;
height: 100px;
width: 100%;
position: relative;
}
div:after {
position: absolute;
top: 100%;
left: 0;
background: #b55;
content: "I SHOULD BE AFTER CONTENT BOX";
width: 100%;
display: block;
}