Require standard property with vendor prefix
Pages 49
- Home
- About
- Avoid un anchored hovers
- Beware of box model size
- Build System
- Build System Integration
- Bulletproof font face
- Command line interface
- Contributing
- Developer Guide
- Disallow !important
- Disallow @import
- Disallow adjoining classes
- Disallow box sizing
- Disallow duplicate background images
- Disallow duplicate properties
- Disallow empty rules
- Disallow IDs in selectors
- Disallow negative text indent
- Disallow non alphabetical
- Disallow outline:none
- Disallow overqualified elements
- Disallow qualified headings
- Disallow selectors that look like regular expressions
- Disallow star hack
- Disallow too many floats
- Disallow underscore hack
- Disallow units for zero values
- Disallow universal selector
- Disallow unqualified attribute selectors
- Don't use too many font size declarations
- Don't use too many web fonts
- Headings should only be defined once
- IDE integration
- Ignoring parts of CSS during linting
- New Release
- Require all gradient definitions
- Require compatible vendor prefixes
- Require fallback colors
- Require properties appropriate for display
- Require shorthand properties
- Require standard property with vendor prefix
- Require use of known properties
- Rules
- Rules by ID
- Source Code
- Unit Tests
- Using in a Node.js Application
- Working with Rules
- Show 34 more pages…
Clone this wiki locally
Vendor-prefixed properties are created by browser vendors to experiment with new CSS features before the standard has been completed. This allows both developers and browser vendors to find bugs and cross-browser compatibility issues without being locked in to a certain behavior in the future. The standard version of the property usually (but not always) has the same name and syntax as the vendor-prefixed version, providing that there are two or more vendor-prefixed versions with the same syntax.
When using vendor-prefixed properties such as -moz-border-radius, you should also include the standard property for future-compatibility. The standard property should come after the vendor-prefixed one to ensure the standard property is used by the browser, such as:
.mybox {
-moz-border-radius: 5px;
border-radius: 5px;
}Putting the standard property after the vendor-prefixed property is the best way to ensure your CSS code will continue to work once the standard property is fully adopted (then you can take your time going back and removing the vendor-prefixed properties).
Rule Details
Rule ID: vendor-prefix
This rule is aimed at ensuring standard properties are included whenever vendor-prefixed properties are used. As such, the rule warns when it finds:
- A vendor-prefixed property without a standard property after it.
- A vendor-prefixed property with a standard property defined before it.
The following patterns are considered warnings:
/* missing standard property */
.mybox {
-moz-border-radius: 5px;
}
/* standard property should come after vendor-prefixed property */
.mybox {
border-radius: 5px;
-webkit-border-radius: 5px;
}The following patterns are considered okay and do not cause warnings:
/* both vendor-prefix and standard property */
.mybox {
-moz-border-radius: 5px;
border-radius: 5px;
}Further Reading
Automated linting of Cascading Stylesheets