Created
May 2, 2017 13:13
-
-
Save huangguozhen/de9d044f737fca0ece67a7dea93db84a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##书写顺序 | |
1.位置属性(position, top, right, z-index, display, float等) | |
2.大小(width, height, padding, margin) | |
3.文字系列(font, line-height, letter-spacing, color- text-align等) | |
4.背景(background, border等) | |
5.其他(animation, transition等) | |
##使用CSS缩写属性 | |
CSS有些属性是可以缩写的,比如padding,margin,font等等,这样精简代码同时又能提高用户的阅读体验。 | |
##去掉小数点前的“0” | |
##简写命名 | |
##16进制颜色代码缩写 | |
##连字符CSS选择器命名规范 | |
1.长名称或词组可以使用中横线来为选择器命名。 | |
2.不建议使用“_”下划线来命名CSS选择器,用“-”。 | |
##不要随意使用Id | |
id在JS是唯一的,不能多次使用,而使用class类选择器却可以重复使用,另外id的优先级优先与class,所以id应该按需使用,而不能滥用。 | |
##为选择器添加状态前缀 | |
有时候可以给选择器添加一个表示状态的前缀,让语义更明了,比如下图是添加了“.is-”前缀。 | |
##常用的CSS命名规则 | |
头:header | |
内容:content/container | |
尾:footer | |
导航:nav | |
侧栏:sidebar | |
栏目:column | |
页面外围控制整体佈局宽度:wrapper | |
左右中:left right center | |
登录条:loginbar | |
标志:logo | |
广告:banner | |
页面主体:main | |
热点:hot | |
新闻:news | |
下载:download | |
子导航:subnav | |
菜单:menu | |
子菜单:submenu | |
搜索:search | |
友情链接:friendlink | |
页脚:footer | |
版权:copyright | |
滚动:scroll | |
内容:content | |
标签:tags | |
文章列表:list | |
提示信息:msg | |
小技巧:tips | |
栏目标题:title | |
加入:joinus | |
指南:guide | |
服务:service | |
注册:regsiter | |
状态:status | |
投票:vote | |
合作伙伴:partner | |
##注意事项 | |
1.一律小写; | |
2.尽量用英文; | |
3.不加中槓和下划线; | |
4.尽量不缩写,除非一看就明白的单词。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment