我想中心对齐灰色框中的条形图。我已经尝试了各种方法(例如文本对齐:中心,或设置显示:块,边距: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