Live data from Hacker News

Things I wish I’d known about CSS

cssfordesigners.com

11–20 of 340 posts

Re: Things I wish I’d known about CSS

#11
for people who want to go deeper on stuff like the box model and specificity and selectors, i highly highly recommend Una Kravets and Adam Argyle's The CSS podcast https://pod.link/thecsspodcast - they are the two CSS devrels from google and they really break it down in depth while explaining things in an accessible way. no vested relationship, just a fan.

Re: Things I wish I’d known about CSS

#13
> Using pixels (px) is tempting because they’re simple to understand: declare font-size: 24px and the text will be 24px. But that won’t provide a great user experience, particularly for users who resize content at the browser level or zoom into content.

Pixels (px) in CSS are relative as well, and scale with zoom. What is the benefit of em/rem?

Re: Things I wish I’d known about CSS

#16

> Using pixels (px) is tempting because they’re simple to understand: declare font-size: 24px and the text will be 24px. But that won’t provide a great user experience, particularly for users who resize content at the browser level or zoom into content. Pixels (px) in CSS are relative as well, and scale with zoom. What is the benefit of em/rem?

>What is the benefit of em/rem?

They (em*) scale with the element's font size, and if you set an elements font-size itself in em, that will be relative to the parent element's font size.

For example:

    body { font-size: 18px }
    .something { border: 0.1em solid black; }
    .something > .inner { font-size: 1.5em }
If you change the font-size on body, everything on that page will re-scale seamlessly. This is most useful for things like buttons/icons that are supposed to flow properly with text. So now even if you use them once in big text, and once in a small footnote, they'll still fit perfectly within the line.

The biggest limitation to this approach is that you can easily end up with computed values that are weird fractions of pixels, so you have to be a bit smart and pick an easily divisible number for your base font-size if you're aiming for something pixel-perfect.

Re: Things I wish I’d known about CSS

#17
Useful article. Getting started with CSS must be harder these days than it was 15-20 years ago. Not only for mobile-friendliness, but also because of the coexistence of flexbox/grid/traditional layouts. I'm wondering if the standard will ever been simplified, instead of being added more and more features.

Re: Things I wish I’d known about CSS

#19
Anybody knows a good book on CSS for ppl with a solid programming background? Every couple of years I try something and fail. Somehow the tutorial rave about the cascading on and on, and when it comes how to strategically design a good SAP working on different devices the stuff gets mute quickly.
Post reply on HN