Modern CSS features like sibling-index() and an upgraded attr() function enable simpler bar chart creation. By using CSS Grid with 100 rows and these new functions, you can build charts where sibling-index() automatically places bars in consecutive columns, while attr() reads data-value attributes to determine bar heights. The technique works for vertical bars, horizontal bars, and marker-based charts, eliminating the need for manual CSS variables or complex hacks that were previously required.

4m read timeFrom css-tricks.com
Post cover image
Table of contents
Automatically Establishing Grid ColumnsAutomatically Establishing Grid RowsLet’s Make Different Charts!Wrapping up

Sort: