那么,通常当我需要对齐框旁边的文本,我这样做: https://codepen.io/Maartinshh/pen/yMdNrW,但我听说它使用 填充和边距这种工作的可怕的错误。有其他选择吗?将文本对齐到另一个元素的最佳方法?
<div class="box"></div>
<div class="text">Text</div>
.box{
background-color:blue;
width: 70px;
height: 70px;
}
.text{
padding-left: 80px;
margin-top: -40px;
}
使用inline-block的+垂直对齐:中间两个DIV –