3 ms·
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 s
by earthboundkid 6y ago
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 use of element selectors should be (mostly) limited to resets.
- rimliu 6y agoIgnore 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.
- LocalPCGuy 6y agoMost 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.
- earthboundkid 6y agoIf you think BEM was created by people who don’t know CSS you may want to read https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect first.