我有一些非常基本的代碼和它的作品,除了一切對齊頂端......最好的酒吧將對準底部。我想我可以使用固定定位,因爲尺寸平方爲50像素×50像素,但我寧願少一點「固定」。CSS柱狀圖 - 很簡單
<div style="border: 1px solid #aeaeae; background-color: #eaeaea; width: 50px; height: 50px;">
<div style="position: relative; bottom: 0; float: left; width: 8px; height: 22px; background-color: #aeaeae; margin: 1px;"></div>
<div style="position: relative; bottom: 0; float: left; width: 8px; height: 11px; background-color: #aeaeae; margin: 1px;"></div>
<div style="position: relative; bottom: 0; float: left; width: 8px; height: 6px; background-color: #aeaeae; margin: 1px;"></div>
<div style="position: relative; bottom: 0; float: left; width: 8px; height: 49px; background-color: #aeaeae; margin: 1px;"></div>
<div style="position: relative; bottom: 0; float: left; width: 8px; height: 28px; background-color: #aeaeae; margin: 1px;"></div>
</div>
我不想使用庫或JS添加。保持這個輕量級是關鍵任務。
而且我喜歡的酒吧是垂直的。任何CSS大師都在關心我擺脫了一點光明,我似乎失蹤了?我GOOGLE和最例子是遠遠複雜/精密,使用position: absolute
,並代替float:left;
使用left: 0px;
,8px
,16px
等
或'vertical-align:text-bottom',適用於我。 – mr5