- Mastering CSS
- Rich Finelli
- 134字
- 2021-07-08 09:45:54
BEM
One technique for keeping specificity low is avoiding descendant selectors altogether using BEM. BEM stands for Block Element Modifier and is a naming convention for CSS. The idea is to use a specific naming convention to add a class to every element you are eventually going to style. This way every element has a specificity score of 10, thus every element has the same specificity. There's a lot more to it that just that, and I recommend checking it out at http://getbem.com/ to learn more about it. I tend to use the BEM methodology, but that's not to say descendant selectors need to be completely avoided. I think there's a time and place for them. My suggestion is keep your descendant selectors reasonable and avoid longer descendant selectors with more than 3 levels.
- JavaScript高效圖形編程
- TensorFlow Lite移動端深度學(xué)習(xí)
- Building a Home Security System with Raspberry Pi
- 圖解Java數(shù)據(jù)結(jié)構(gòu)與算法(微課視頻版)
- Visual Basic程序設(shè)計(jì)教程
- Python面向?qū)ο缶幊蹋簶?gòu)建游戲和GUI
- Python:Master the Art of Design Patterns
- Getting Started with NativeScript
- The DevOps 2.5 Toolkit
- Visual Basic程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)(第二版)
- 從零開始學(xué)C語言
- Programming with CodeIgniterMVC
- Go語言開發(fā)實(shí)戰(zhàn)(慕課版)
- 零基礎(chǔ)學(xué)Java第2版
- Professional JavaScript