我想中心對齊灰色框中的條形圖。我已經嘗試了各種方法(例如文本對齊:中心,或設置顯示:塊,邊距:0自動)閱讀相關的帖子,並沒有一個似乎工作。中心對齊跨度標記中的SVG
這裏的小提琴: http://jsfiddle.net/nickciao/F6R9C/93/
的HTML:
<div id="Tile">
<h2>
<span id="Top">0.0%</span>
</h2>
<ul class="Middle">
<span>2.9k</span>
USERS
<span>BECAME ACTIVE</span>
</ul>
<div id="Bottom" >
<div>
<svg id="svg">
<g transform="translate(5,5)">
<rect y="23.33333333333333" x="15" height="11.666666666666671" width="5">
</rect>
<rect y="35" x="21" height="0" width="5">
</rect>
<rect y="25.666666666666686" x="27" height="9.333333333333314" width="5">
</rect>
<rect y="35" x="33" height="4.666666666666686" width="5">
</rect>
<rect y="25.666666666666686" x="39" height="9.333333333333314" width="5">
</rect>
<rect y="25.666666666666643" x="45" height="9.333333333333357" width="5">
</rect>
<rect y="25.666666666666686" x="51" height="9.333333333333314" width="5">
</rect>
<rect y="30.333333333333343" x="57" height="4.666666666666657" width="5">
</rect>
<rect y="32.666666666666686" x="63" height="2.3333333333333144" width="5">
</rect>
<rect y="32.66666666666664" x="69" height="2.333333333333357" width="5">
</rect>
<rect y="16.33333333333333" x="75" height="18.66666666666667" width="5">
</rect>
<rect y="32.666666666666686" x="81" height="2.3333333333333144" width="5">
</rect>
<rect y="35" x="87" height="0" width="5">
</rect>
<rect y="35" x="93" height="20.999999999999993" width="5">
</rect>
<rect y="35" x="99" height="34.999999999999986" width="5">
</rect>
</g>
</svg>
</div>
</div>
編,看起來它是一個的搞亂這個單獨的矩形寬度向上。是否有CSS方法來確定這些矩形的大小?或者我是否需要計算它們的寬度以完全適合父容器? – nciao