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

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.

主站蜘蛛池模板: 通道| 庄浪县| 勃利县| 都昌县| 申扎县| 五寨县| 天峨县| 岳西县| 阳西县| 洛扎县| 罗城| 新绛县| 阿城市| 石城县| 延津县| 无棣县| 红安县| 新蔡县| 招远市| 邹平县| 霞浦县| 望奎县| 友谊县| 武功县| 五华县| 万山特区| 娄底市| 饶阳县| 滦平县| 林芝县| 晋江市| 呼图壁县| 来宾市| 西丰县| 榆林市| 伊金霍洛旗| 平度市| 维西| 临武县| 朔州市| 华安县|