Live data from Hacker News

Principles we use to write CSS for modern browsers

gist.github.com

91–100 of 129 posts

Re: Principles we use to write CSS for modern browsers

#91
post #72

Earlier quoted context omitted.

There isn't an alternative really. Like Javascript, it's all there is.

So are these other tools people are talking about some different methods that just transpile back to CSS in the end or something like that?

Yep (such as LESS, SASS, SCSS, etc)

Re: Principles we use to write CSS for modern browsers

#92
post #3

A bit meta, but I need this off my chest: I love how this document starts off saying "this is for react apps". IMO every discussion about CSS coding standards needs to start with context. A lot of old CSS lore came from people who build websites. I mean those fairly uninteractive things, focus on content. Blogs, restaurants, newspapers. Building an application that happens to use the DOM as their UI toolkit is totall…

"reuse the same classes but with different content"

What difference does the content make if the styling is meant to be the same?

"reuse pieces of behavior"

Now, that made me curious. Can you expand on that because I'm not sure I quite understand what you mean.

edit: I've read through the naming convention they describe and I don't see much anything that different than how I would create CSS for a website. It's just a clean naming convention that would work for a website as well as an application.

Re: Principles we use to write CSS for modern browsers

#93

Earlier quoted context omitted.

Enterprise in the US. IE9 still rules, in many cases. I actually work all over this space, do not tell me otherwise. And now I have to maintain two codebases?

Been there, done that. But you might mention to bosses/clients that MS no longer supports/patches anything older than IE-11 on desktop versions of Windows. They are most likely using an un-patch-able version of Explorer. Virii, Trojans and Hacks, oh my! https://www.microsoft.com/en-us/WindowsForBusiness/End-of-IE...

Excellent advice that I give my students, and readers here will be well-served in following it.

I don't even want to admit how many managers come back to them with "we mitigate that risk with user education, we have too many legacy (blah blah blah)." There's always some excuse, isn't there? Usually within departments, but once executive-level hears this sort of thing, they tend to at least investigate what the real risks are. So I'm adding on to your advice to other readers to suggest they "go higher" with their security warning.

Man, I wish we lived in a world where management understood that people are shockingly good at finding ways of not doing what they're told!

Re: Principles we use to write CSS for modern browsers

#94
post #59

Earlier quoted context omitted.

I agree with respect to 3rd party libraries. One of the things I hate most about Bootstrap is its amazing overuse of !important. However, my context was mainly around architecting your own CSS, not as it relates to using someone else's.

My approach is to slap myself in the face each time I need to use !important. That's enough to prevent me from slipping into bad habits but leaves me with an option if rewriting my CSS to work around somebody else's (or my own) hacks would be more painful than a slap in the face. I do occasionally get strange looks from my colleagues.

Just wear a rubber band on your wrist and snap that instead. Your colleagues will just think you're trying to stop smoking.

Re: Principles we use to write CSS for modern browsers

#95
post #24

Earlier quoted context omitted.

It's still common to find Citrix environments with IE 8/9 here in .nl healthhcare sector

Someone should write an exploit for IE 8/9 that upgrades them to Firefox.

Google did that back in the day with Chrome.

https://www.chromium.org/developers/how-tos/chrome-frame-get...

Discontinued though.

Re: Principles we use to write CSS for modern browsers

#97
Personally, I very much dislike using CSS classes unless required. I prefer having a clean markup with classes used only where they make sense.

For a context, I somehow can't wrap my head around writing something like:

    
when `` makes more sense. Sure, if you have a case with alternate "inverse" navbar, go ahead with a class ``.

About the flexbox, ah, well, even now they have undefined behaviour on several elements such as a `fieldset` [1].

[1]: http://stackoverflow.com/questions/28078681/why-cant-fieldse...

Re: Principles we use to write CSS for modern browsers

#98
post #7

Some thoughts: - Good CSS design needs zero !important statements. Fix your specificity or your component architecture if you have a need to use !important. - DRY is a good thing, not a bad thing. Maybe straight CSS isn't quite there yet but... - Why not use the tools at your disposal to aid in development (and DRY) such as SASS/LESS? - Flexbox will be great once IE dies the well-earned death it deserves. I'm very ha…

css variables too

Re: Principles we use to write CSS for modern browsers

#99

Earlier quoted context omitted.

I've done those verticals, too. We always had Firefox. I don't know what it's like now. That was 10 years ago. (AKA sit down and shut up with your bullshit "sit down and shut up"s)

I literally deal with students in every class, a not-small percentage of students, that are disallowed by domain policy from installing another browser.

I literally think you're an asshole for thinking you know everything about how enterprise works.

IT can be brow beat just as hard as developers. They will change whatever domain policies you make them change. Quit being a pushover.

Re: Principles we use to write CSS for modern browsers

#100

Earlier quoted context omitted.

What amazes me is how violently the run-of-the-mill programmer hates namespaces. Despite the fact that managing namespace collision is important for composability (either deliberate or accidental) and code generation. This problem has, for instance, dogged RDF. All the time I hear about programmers who "don't want to learn SPARQL" and I think the heavy use of namespaces is one of the impediments. For most other progr…

That reminds me of a colleague complaining about a recent cohort of about 60 webdev graduates. Not a single one wanted to learn perl, but were quite happy to get stuck into anything Javascript preferably react! EDIT: why the downvotes?

I've worked in enough Perl at one point to actually like it but I would never recommend anyone learn it unless they absolute have to. At this point it's effectively a dead ended language. It's also a terribly difficult language to learn.

I don't particularly like the Javascriptification of every technology but these webdev graduates have the right idea.

Post reply on HN