Live data from Hacker News

Learn CSS

web.dev

131–140 of 196 posts

Re: Learn CSS

#131
post #41

This looks good. I've been using mdn mostly; but I usually go deep into CSS for a bit then leave it for long periods of time. That said, what has replaced SASS? I'm struggling to find a preprocessor that allows nesting/grouping etc. Or is that built into CSS by now? Being able to nest CSS was a game changer for me in terms of css organization.

I'd say that "nesting is bad" has replaced SASS. Nesting encourages long selector chains which are generally a bad practice. That CSS makes this painful is a nice reminder to only use long selector chains where necessary.

Sass still has a lot of popularity in the BEM world where you can use nesting to generate flat classnames that would be tedious to write out by hand, e.g.:

  .element {
    &__title {
      color: red;
    }
  
    &__subtitle {
      color: blue;
    }
  }
which compiles down to:

  .element__title {
    color: red;
  }
  
  .element__subtitle {
    color: blue;
  }
There's a lot of (valid) criticism that this makes code harder to grep, although if you structure things well it's still easy to find via the base element class. BEM and approaches like this in general tend to require a lot of discipline and organization to pull off effectively.

Re: Learn CSS

#132
post #126

Earlier quoted context omitted.

I'm glad we sacrificed any concept of hierarchy, scope and structure so that CSS files can be parsed by regex.

It can still refer to hierarchies via selectors. Honestly I think that's a fantastic way to handle it.

I think it has good and bad sides, but looking at the specs/draft-proposal for the new functionality being drawn and the hoops the syntax has to make in order to preserve the "it's regular language" while incorporating long time needed functionality it seems like it's a bad choice - one of those things that in some years people will go, "why tf is this like this"

I understand a proper parser would (perhaps) be more complex, but could also be open sourced in a lower level lang such as C, and then used by everyone, there's also already the full test suites for testing the output - maybe even Google+MS+Moz could open a contest - "fastest, most readable and efficient parser in C (or rust, wtv) takes 10k home"

Re: Learn CSS

#133

I'm the content lead for web.dev. Just wanted to give a quick shout out to the people who made this happen because it's not clear on the site. I think this is also useful information because you'll see that a lot of CSS experts we're involved in this project. Adam Argyle [1] and Una Kravets [2] created the podcast series. Una mainly drove the overall project to convert the podcasts into this written series. Adam prov…

It is interesting that this uses a podcast + text rather than what would have been a more conventional video based tutorial. The use of a podcast for describing something so fundamentally visual as CSS looks really unusual. I just started going through and came back here to note that it somehow seems to work well!

I wonder if videos are a little overused as tutorials. Videos aren't very searchable (yet), and they are unreliable to scan through (in most scrubbing implementations I've seen), so while they are nice to get started, they are hard to return to later to brush up on something.

I love this podcast + text approach in theory. A podcast to talk through the material, and a really well written page to reference. The CSS Grid page is a great example of this.

Aside: As someone who has been in web dev for a while, sometimes I feel like what I need is an "unlearn CSS" tutorial, to erase some old habits.

Re: Learn CSS

#134

I'm the content lead for web.dev. Just wanted to give a quick shout out to the people who made this happen because it's not clear on the site. I think this is also useful information because you'll see that a lot of CSS experts we're involved in this project. Adam Argyle [1] and Una Kravets [2] created the podcast series. Una mainly drove the overall project to convert the podcasts into this written series. Adam prov…

This is amazing. Did y'all use any kind of static site generator or documentation tool (e.g. Antora) or was it hand rolled?

Re: Learn CSS

#135

I'm the content lead for web.dev. Just wanted to give a quick shout out to the people who made this happen because it's not clear on the site. I think this is also useful information because you'll see that a lot of CSS experts we're involved in this project. Adam Argyle [1] and Una Kravets [2] created the podcast series. Una mainly drove the overall project to convert the podcasts into this written series. Adam prov…

This is amazing. Did y'all use any kind of static site generator or documentation tool (e.g. Antora) or was it hand rolled?

All of web.dev is open source. Here's the directory [1] for the Learn CSS content. The site is all based on Eleventy [2]. I don't know if Rob (engineering lead [3]) and team did any funny stuff for the Learn CSS infrastructure in particular but you can ping him on Twitter for questions.

[1] https://github.com/GoogleChrome/web.dev/tree/main/src/site/c...

[2] https://www.11ty.dev/

[3] https://twitter.com/rob_dodson

Re: Learn CSS

#136
post #99

Earlier quoted context omitted.

Until somebody has another similar box so they reuse login-box a bunch in your application, then you realize that they actually need to be customized and have to tear it all apart. Tailwind doesn't make you copy and paste, it moves the reuse of styles out of CSS which sucks at managing reuse into whatever HTML building system which likely has some concept of reusable views.

> Until somebody has another similar box so they reuse login-box a bunch in your application Then they make `.box` and include it as a mixin. Like CSS developers have done for a decade (and which tailwind itself does using PostCSS) > Tailwind doesn't make you copy and paste Yes it does. Moving all styles into individual elements without reuse is copy and paste.

> Yes it does. Moving all styles into individual elements without reuse is copy and paste

Tailwind all but assumes you will be using something that allows you to extract HTML into components, be that something like React or Vue, or classic partials in a server-side templating language like Twig. You reuse the entire component, rather than just the CSS, which IMO is far better aligned with how apps are actually built.

So no, using Tailwind classes is no more copy pasting than typing CSS in full into a separate stylesheet is copy pasting.

Re: Learn CSS

#137
Does anyone have recommendations for tutorials/books/courses that go beyond explaining the basics of CSS to how to actually design stuff with CSS. I've gone through numerous this is how Flex and Grid work, this is list of all the options for Flex and Grid, this is why we used tables in the old days and Float had it's problems. I'd like to learn how to use the building blocks of CSS as they are now and ... you know be able to learn how to make nice looking designs.

I realize to actually get good at design requires elbow grease and practice, but it still would be nice to have a good teacher/guide to show you how things are done now.

Re: Learn CSS

#138
post #137

Does anyone have recommendations for tutorials/books/courses that go beyond explaining the basics of CSS to how to actually design stuff with CSS. I've gone through numerous this is how Flex and Grid work, this is list of all the options for Flex and Grid, this is why we used tables in the old days and Float had it's problems. I'd like to learn how to use the building blocks of CSS as they are now and ... you know be…

I thought this book was helpful https://www.refactoringui.com/book

Re: Learn CSS

#139
post #137

Does anyone have recommendations for tutorials/books/courses that go beyond explaining the basics of CSS to how to actually design stuff with CSS. I've gone through numerous this is how Flex and Grid work, this is list of all the options for Flex and Grid, this is why we used tables in the old days and Float had it's problems. I'd like to learn how to use the building blocks of CSS as they are now and ... you know be…

In practice, most FE jobs consist of a designer that produces mocks in Figma or InDesign or similar, then you as the engineer take those mocks and make JS+CSS out of it.

As for what the designers do, it's mostly copying ideas from popular apps and tweaking it to appease the product people, who are requesting changes to appease leadership.

Post reply on HN