by crazypython · 5y ago · 0 comments
Semantic: embed data directly in HTML. If I have a list of wines with categories, each wine's "class" attribute has a class for each category.
HTML: can be generated by anything and consumed by anyone. Great SEO.
CSS: These websites were all made with the same HTML, only CSS changing. http://www.csszengarden.com/
Let's imagine we have a checkbox, that when checked, should dim every wine that is not a white wine. Next to it is a div of wines, with the "container" class. The div contains wine elements.
3 lines of CSS:
input[type="checkbox"].whiteWine:checked + .container > :not(.whiteWine) {
opacity: 0.5;
}
You can replace the checkbox's appearance with an image, a video, just about anything– it doesn't have to look like a checkbox.This would take many lines of JavaScript in any other framework.
Instead of attempting to warp HTML into a UI library, this uses HTML as a data format, and CSS as a way to present that data.
Great example, btw!