官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 喜德县| 佛山市| 浮山县| 西乌珠穆沁旗| 柳林县| 黔江区| 丹江口市| 天气| 炎陵县| 犍为县| 内丘县| 临颍县| 鸡西市| 基隆市| 恩平市| 林州市| 伊宁县| 红安县| 应用必备| 墨脱县| 四平市| 平湖市| 名山县| 深圳市| 宜君县| 铁力市| 卢湾区| 万荣县| 开平市| 长泰县| 阜康市| 澎湖县| 亳州市| 龙井市| 宽城| 桐庐县| 梁平县| 桃园市| 东乌珠穆沁旗| 台北市| 定州市|