Comments (3)
这个难道不应该简写成
background:red url(images/bg.gif) no-repeat top right;
另外,这条规则的主要**是在保持正确性的前提下尽可能的节省代码量,不能因为存在潜在的问题而否定大部分有效的情况。
这条建议也可以加到注意事项中提醒大家注意副作用。
from styleguide.
是的,我的例子确实不恰当,我主要是想说明一下这个特性,可能更恰当的例子是下面这样
//css代码
body { background-color: #f8f8f8; }
.some { background-color: red; }
.some:hover { url(images/bg.gif) no-repeat top right; }
本意是想在.some
元素上hover
时改变背景图片,但是背景图片如果加载失败了,那么背景色并不是变为原本的red
,而是#f8f8f8
,可能这并不是我们想要的结果。如果总是将简写中属性写全那么就不会有这个问题,但貌似很多人在简写时都只是写部分属性
from styleguide.
是的,这样的情况确实存在,我在这条规则后增加了注意事项以及你提供的参考链接。
另外,Code Guide by@mdo: Shorthand notation的规范展现风格很赞啊,后续可以参考下。
from styleguide.
Related Issues (20)
- 源码目录规范,需要细化
- 不建议要求同作用域的变量在function头部申明 HOT 1
- 对短路写法怎么看 HOT 4
- 我在我的翻译项目中引用了各位大神的Markdown代码规范。 HOT 4
- "user strict" 是否要求? HOT 2
- 是否要阻止对基础对象原型的拓展或修改 HOT 1
- 对 arguments.caller 和 arguments.callee 的使用有什么看法? HOT 2
- node-jscs 这个检查工具似乎不错 HOT 4
- 强制function声明在作用域头部
- 缩进使用 2 个空格还是 4 个空格 HOT 28
- 这个 UI 规范写得真好 HOT 1
- 4.2.1 錯字 :)
- “避免使用 /*...*/ 这样的多行注释。有多行注释内容时,使用多个单行注释。” HOT 1
- 对象数组如何注释 HOT 3
- 颜色值强制不允许使用命名色值的疑问 HOT 4
- 点击2.4.8函数注释,链接失效? HOT 1
- 你们这项目还维护吗?代码风格检查工具还做不? HOT 1
- 你们css规范里url()函数之间没加逗号
- 生成的文件放源码中很容易冲突 HOT 2
- if, for等强制{}会不会更好点 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styleguide.