请参阅我的 HTML,我需要一些帮助:
<div class="parent">
<div class="child"></div>
</div>
CSS:
.parent{position:absolute; height:50px; width:120px; background:green}
.child{background:red; width:15px; height:15px; }
现在我想把子内容放在中间。但是 parent 设置为绝对值,因此它不能与 line-height 一起使用。谢谢你的帮助。
请参阅此处的jsfiddle 。