Could Grouping HTML Classes Make Them More Readable?

added by JavaScript Kicks
4/22/2019 9:00:41 PM

339 Views

You can have multiple classes on an HTML element: Nothing incorrect or invalid there at all. It has two classes. In CSS, both of these will apply: const div = document.querySelector("div"); console.log(div.classList.contains("module")); // true console.log(div.classList.contains("p-3")); // false But what about grouping them? All we have here is a space-separated string.


0 comments