如何在动态宽度
的内联元素旁边设置float元素HTML
<div>
<span>Lorem ipsum dolor</span>
<span class="floater"></span>
</div>
CSS
DIV{
width: 100px;
}
SPAN.floater{
height:4px;
width:4px;
margin-top:3px;
float:left;
background-color: #FF0000;
}
答案 0 :(得分:1)
查看此http://jsfiddle.net/J2Df8/12/
HTML
<div>
<span>Lorem ipsum dolor<span class="floater"></span></span>
<span>Lorem ipsum dolor<span class="floater"></span></span>
</div>
CSS
div {
width: 100px;
}
div span {
display:inline-block;
position:relative;
padding-right:10px;
}
span.floater{
display:block;
padding:0;
height:4px;
width:4px;
top:8px;
right:0;
position:absolute;
background-color: #FF0000;
}
答案 1 :(得分:0)
HI现在已经习惯了你:after
就像这样
span{
width: 100px;
display:block;
}
span:after{
content:'';
height:4px;
display:inline-block;
width:4px;
background-color: #FF0000;
}
的 Live demo 强> 的