News for hackers. Stuff that matters.
Re:Ask HN: What novel tools are you using to write web sites... by crazypython on Sunday April 04, 2021 @09:11PM (#26694368)
Semantic HTML, CSS, Vanilla JS, and JAMStack.

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.

Re:Ask HN: What novel tools are you using to write web sites... by busymom0 on Monday April 05, 2021 @04:50AM (#26696705)
Re:Ask HN: What novel tools are you using to write web sites... by crazypython on Monday April 05, 2021 @10:31AM (#26699481)
Indeed, and that website only uses 2010 CSS features.
Re:Ask HN: What novel tools are you using to write web sites... by nickthemagicman on Sunday April 04, 2021 @09:36PM (#26694487)
IS CSS really this well featured and expressive these days? I havent tinkered with it in years.
Re:Ask HN: What novel tools are you using to write web sites... by chrismorgan on Monday April 05, 2021 @12:12AM (#26695282)
:checked and :not() have been dependable for quite a few years now. Firefox has had ’em since at least version 1 (2004), Safari got ’em in 3.1 and 3.2 (2008), and Internet Explorer was the last player to the table in Internet Explorer 9 (March 2011). The rest of the selector features (tag, attribute, class, adjacent sibling, child) are older still (IE7 supported it all).
Re:Ask HN: What novel tools are you using to write web sites... by nickthemagicman on Monday April 05, 2021 @10:49AM (#26699770)
That's totally awesome. Everyone always just jumped to JavaScript for that kind of thing with jQuery.
Re:Ask HN: What novel tools are you using to write web sites... by b0afc375b5 on Sunday April 04, 2021 @09:57PM (#26694581)
Yep, thank god for flexbox and grid layouts.
Re:Ask HN: What novel tools are you using to write web sites... by dkarras on Monday April 05, 2021 @01:38AM (#26695670)
What happens when your wine types are dynamic? How do you typically bridge the gap?
Re:Ask HN: What novel tools are you using to write web sites... by rbdone on Sunday April 04, 2021 @10:18PM (#26694674)
What’s old is new again <3

Great example, btw!