Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stacked bar chart in HTML/CSS
All of the google results for this are outdated / don't work. Here's a simple fiddle that stakes div relative to the bottom of its container div.
http://jsfiddle.net/9pXpU/
<div class="colWrapper">
<div class="barContainer">
<div class="bar" style="background-color:#b4cde2;"></div>
<div class="bar" style="background-color:#7ca7cc;"></div>
<div class="bar" style="background-color:#6094c1;"></div>
<div class="bar" style="background-color:#3b6d97;"></div>
</div>
</div>​
.colWrapper{
height:200px;
width:100px;
position:relative;
border:1px solid #ccc;
}
.barContainer{
position:absolute;
bottom:0;
width:100%;
}
.bar{
widith:100%;
height:20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment