Skip to content

Instantly share code, notes, and snippets.

@csessig86
Created November 5, 2013 23:13
Show Gist options
  • Save csessig86/7328071 to your computer and use it in GitHub Desktop.
Save csessig86/7328071 to your computer and use it in GitHub Desktop.
Bar charts with Bootstrap. As used with election 2013 website
<table class='vote-results-table'>
<tr>
<td >
<div class='vote-results-header'>Results</div>
</td>
</tr>
{{#each candidates}}
<tr>
<td width='250px'><strong>{{candidate}}</strong>: {{votes}} votes</td>
</tr>
<tr>
<td width='200px'>
<div class='bar-container' id='{{whitespaceRemove candidate}}_bar' style='width:100%'>
<div class='bar' style='width:{{votepercent}}%'></div>
<div class='vote-percent-text'>{{votepercent}}%</div>
</div>
</td>
</tr>
{{/each}}
</table>
/***** Vote count *****/
.vote-results-header {
font-family: Georgia, serif;
font-weight: bold;
font-size: 16px;
text-shadow: 0 1px 1px rgba(99, 99, 99, 0.25);
}
.vote-results-percent {
font-size: 12px;
}
@media (max-width:600px) {
.vote-results-table {
float: left;
margin-top: 10px;
}
}
.vote-results-table td {
padding-left: 10px;
}
.bar-container .bar {
height: 16px;
color: #FFFFFF;
padding: 5px 2px;
background-color: #2C7FB8;
border-right: 1px solid #252525;
float: left;
margin-right: 5px;
}
.vote-percent-text {
padding: 3px 0 0 5px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment