無需 JavaScript/圖片,僅用 DIV+CSS 繪製美觀統計條,適合後台儀表板、數據展示區塊。

width:100% 代表 100%。<span> 或 <em> 設定 display:block; width:XX%; background:color; 表示數值比例。float 或 flex 排列標籤、數值、條形。.stat-bar { display:flex; align-items:center; margin:10px 0; font-size:14px; }
.stat-label { width:120px; flex-shrink:0; text-align:right; padding-right:10px; color:#333; }
.stat-value { width:50px; flex-shrink:0; color:#666; }
.stat-track { flex:1; height:24px; background:#eee; border-radius:12px; overflow:hidden; position:relative; }
.stat-fill { display:block; height:100%; background:linear-gradient(90deg, #3498db, #2980b9); border-radius:12px; transition:width .3s ease; }
<div class="stat-bar">
<span class="stat-label">瀏覽量</span>
<div class="stat-track"><span class="stat-fill" style="width:68%;"></span></div>
<span class="stat-value">68%</span>
</div>