请注意这个简单的 jsFiddle:http: //jsfiddle.net/mark69_fnd/vtLrt/10/
HTML:
<div class="char">
<div>
<div class="char">A1</div>
<div class="char anchorToMiddle">D1</div>
<div class="char anchorToRight">G1</div>
</div>
<div>
<div class="char">A2</div>
<div class="char anchorToMiddle">D2</div>
<div class="char anchorToRight">G2</div>
</div>
<div>
<div class="char">A3</div>
<div class="char">B3</div>
<div class="char">C3</div>
<div class="char">D3</div>
<div class="char">E3</div>
<div class="char">F3</div>
<div class="char">G3</div>
</div>
</div>
CSS:
.char{
display: inline-block;
}
.anchorToRight {
float: right;
}
输出:
如何更改 HTML 和/或 CSS,以便标记为anchorToMiddle
(D1 和 D2)的元素在 D3 正上方的中间对齐?
谢谢。