Dynamic height for bar graphs

I have created a bar graph, I am handling bar height through Static CSS, can I achieve the bar height dynamically through JavaScript or HTML-CSS.

here is my fiddle:


Well sure, you can set the height directly in the markup like

<li class="bar nr_1 bar ht_1 red" style="height: 100px">
  <div class="top"></div>
  <div class="bottom"></div>

This is one of the few cases where inline-styles are absolutely okay, as they are actually part of the content (so to say) and specific to one single element. And if you’re generating the markup from some data on the backend, you can easily apply the height in one go.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.