Created
September 27, 2012 19:58
-
-
Save mhkeller/3796135 to your computer and use it in GitHub Desktop.
Stacked bar chart in HTML/CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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