Live data from Hacker News

Things I wish I’d known about CSS

cssfordesigners.com

191–200 of 340 posts

Re: Things I wish I’d known about CSS

#191
post #162

Earlier quoted context omitted.

Yes. There are different philosophies for how to write CSS, but assuming you're aiming at something like BEM (Block, Element, Modifier) style, it's typical to start with a reset of the raw elements into a standard form, and then follow that with the CSS for you class components, and finally some !important override utilities. Basically all the CSS philosophies agree that you should never use #id selectors at all and…

Ignore all above is you are not keen to go the path of cargo-culting. Most of those philosophies were brought to you by people who were too lazy to learn CSS.

Most are from very respected people to help others benefit from their knowledge and to avoid the pitfalls they ran into a various levels of scale. Do you need BEM for a brochure-ware site, no, styling by IDs and tags would probably work just fine. But a web app with 1000s of lines of code, while I don't specifically endorse BEM, some sort of pattern and methodology will save you a world of pain in the long run.

Re: Things I wish I’d known about CSS

#192
post #55

Guys we need to talk. Are you capsbold serious? These are things that you learn in a first week of doing web development tutorials. I read this thread and it makes me think that I'm delusional because of a heat wave. Margins collapse? :focus exists? Me not getting a joke? I don't understand.

It's also good to remember that new devs make up something like 50% of the developer population each year (I forget the exact number, maybe it's every 2 years). So while this may be basic information to someone who's been doing this for at least a few years (and I'd argue it isn't, particularly since the site isn't aimed at Front End Devs, per se, but others who have to do front end development), it is valuable information for the target audience.

Re: Things I wish I’d known about CSS

#193

I wish the author had gone a bit further into em vs rem. I'm reading other articles on the topic but they're simply technical explanations and I'm still not clear on what features of the page are best designed using em or rem.

Just to mess with your mind: in media queries and in the root element’s font-size declaration, em and rem mean the same thing, being the browser’s default font size, which is 16px in most browsers by default, but customisable in some browsers and different by default in some environments (e.g. I seem to recall Kindle using 19px). I call this unit the “browser em”, or bem . No one else really talks about it. One thing…

I would guess it does matter about the language, but likely because as the language changes the font itself may actually change. And different fonts would have different relative font sizes. But like you, I haven't investigated it enough to make a definitive statement about it.

Re: Things I wish I’d known about CSS

#194
post #181

CSS is such a weird abstraction. Who thinks in blocks and inline blocks? Who thinks in paddings and margins? Floats, etc? I know these are more flexible, but I've always found grid-based frameworks to be far more intuitive

An off-the-shelf grid system is too inflexible, and you spend more time customizing it or fighting it to get the result you need than you would have just building what you need.

Re: Things I wish I’d known about CSS

#195

> 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?

Yeah I came here to ask this. Using relative units for layout seems like a terrible idea. If you want to make your text a little bigger, your entire layout changes too. That's fine if it's something like text padding or paragraph margins, but stuff like border width, or dimensions of boxes? That seems weird.

Browsers have been able to zoom pixel widths for years.

Re: Things I wish I’d known about CSS

#196
post #46

Earlier quoted context omitted.

Sometimes I wonder why companies even pay developers so much in the US. It boils down to real estate prices combined with some companies really really really wanting those people to be on site. I had my highest rate ever during a brief, beautiful moment in Switzerland where a studio apartment costs ~$2000 per month. I choose to think that this rate is how much our work is actually worth - otherwise those companies co…

This is a catch 22, high wages make the rent increase (demand and offer) and high rents demand high salaries, it's a spiral going to a bubble.

Indeed, but eventually a ceiling is reached over which it would be impossible to make a profit having on-site employees.

I don't envy the locals though. I spent 2,5 months in Zurich, during which I saved so much that in pre-corona times it would be enough for the minimal allowed down payment for an apartment.

The Swiss don't have a Switzerland of Switzerland where they could pull off the same trick.

Re: Things I wish I’d known about CSS

#198
post #181

CSS is such a weird abstraction. Who thinks in blocks and inline blocks? Who thinks in paddings and margins? Floats, etc? I know these are more flexible, but I've always found grid-based frameworks to be far more intuitive

CSS is a very reasonable abstraction for the job it was originally designed for: layouting of mostly textual documents. As such it borrows its concepts from the desktop publishing world. Margin and padding make absolute sense when you think in terms of headings and paragraphs. Float is an established term for having text flow by an image or other rectangular insertion. And so on. You have to remember the context in which CSS was first conceived. The Web looked quite different then.

Re: Things I wish I’d known about CSS

#199

Earlier quoted context omitted.

> before-taxes salary of USD 70.5k, and a salary after all taxes of USD 47k. What!? That's over 30% of your income gone, and for a relatively average income. That's not even counting VAT and other taxes.... No wonder there's so much "free" stuff in Europe.

Notably, I doubt you could get family healthcare coverage in the US that reduced your financial risk as much as France’s does for under $25,000/yr. Even at that rate I bet your exposure’s still worse.

> I doubt you could get family healthcare coverage in the US that reduced your financial risk as much as France’s does for under $25,000/yr.

I'm not so sure. It looks like the average liability for a family (12 monthly premiums plus deductable) comes in at just under $23k[1]. That's the max the average family would pay. Obviously for just a single person total liability is a lot lower.

So for a person like me who makes good money being an engineer, I am still better off in America where I can make a lot of money but also pay a little more in COL / healthcare stuff.

[1] https://www.ehealthinsurance.com/resources/individual-and-fa...

Re: Things I wish I’d known about CSS

#200
post #126

It always helped me to do an absolute basic concepts course on a new technology I learn. Like, sure I can play around in Photoshop or Eclipse or CSS or JavaScript and find most things. But a good 101 course is worth so much saved time. Most of the stuff in that article was mentioned in a CSS box model course I did 10 years ago. People were always baffled how I learned all this. Well, I read the docs! They always assu…

I built my first site in the 90's too (before CSS)! I've been in higher education lately, but have a YouTube channel with mostly CSS related content (both beginner & advanced). Check that out if you're interested in some great starter learning content for CSS and you prefer video format: https://www.youtube.com/followandrew
Post reply on HN