Useful

Setting Variables w/ style: Bar Chart

Recently, I came across some HTML code that looked like this: <span style="--w: .5">...</span>. "Wow, you can use variabls in a style attribute?!?" In this pen, I experiment with using this method of updating an element's style to produce a horizontal bar chart.

Selected Favorite Vegetables1 All Adults
Popularity: Percent of people who have a positive opintion of the vegetable
Potatoes
90% enjoy potatoes
Sweetcorn
83% enjoy sweetcorn
Carrots
81% enjoy carrots
Cucumbers
78% enjoy cucumbers
Spinach
74% enjoy spinach
Asparagus
70% enjoy asparagus
Celery
69% enjoy celery
Cauliflower
63% enjoy cauliflower
Data Source
"The Most Popular Vegetables (Q12025)" (YouGov | US)