File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change 45
45
* [属性书写顺序](#order)
46
46
* [注释规范](#css-comment)
47
47
* [hack规范](#hack)
48
- * [避免类型选择器 ](#type -selector)
48
+ * [避免低效率选择器 ](#low -selector)
49
49
* [属性缩写与分拆](#override)
50
50
* [模块化](#css-module)
51
51
6 . [ 图像约定] ( #img )
@@ -824,21 +824,32 @@ if条件共包含6种选择方式:是否、大于、大于或等于、小于
824
824
目前的常用IE版本为6.0及以上,推荐酌情忽略低版本,把精力花在为使用高级浏览器的用户提供更好的体验上,另从IE10开始已无此特性
825
825
```
826
826
827
- <a name =" type -selector" ></a >
828
- ### 16.避免类型选择器
827
+ <a name =" low -selector" ></a >
828
+ ### 16.避免低效率选择器
829
829
830
- * 避免出现标签名与ID或class组合的选择器
831
- * 太多这种写法会让你的CSS效率变得糟糕
830
+ * 避免类型选择器
832
831
833
- 不推荐 :
832
+ 不允许 :
834
833
835
834
div#doc{ sRules; }
836
835
li.first{ sRules; }
837
836
838
- 推荐 :
837
+ 应该 :
839
838
840
839
#doc{ sRules; }
841
840
.first{ sRules; }
841
+
842
+ > CSS选择器是由右到左进行解析的,所以 div#doc 本身并不会比 #doc 更快
843
+
844
+ * 避免多id选择器
845
+
846
+ 不允许:
847
+
848
+ #xxx #yyy{ sRules; }
849
+
850
+ 应该:
851
+
852
+ #yyy{ sRules; }
842
853
843
854
<a name =" override " ></a >
844
855
### 17.属性缩写与分拆
@@ -973,7 +984,7 @@ body{
973
984
}
974
985
.m-detail-hd .title{
975
986
background: #eee;
976
- }
987
+ }
977
988
.m-detail-bd{
978
989
padding: 10px;
979
990
}
You can’t perform that action at this time.
0 commit comments