DEV Community

Discussion on: Create a tag cloud with HTML and CSS

Collapse
 
jonole profile image
Jon Ole Ueland

Here is a 3-liner script that will rid you if the manual setting of the --size variable in the stylesheet.

document.querySelectorAll('ul.cloud a').forEach((i) => {
i.style.setProperty('--size', i.dataset.weight);
});

Collapse
 
murkrage profile image
Mike Ekkel

While this is a simple script, it defeats the purpose of being just HTML and CSS. Still a good solution, tho!