Disallow box sizing
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
The CSS box-sizing property is used to define how borders, padding, width, and height interact with each other. The default value is content-box, meaning that width and height refer to an element's content, and then padding and borders are added around it. Consider the following:
.mybox {
border: 1px solid black;
padding: 5px;
width: 100px;
}The actual width of this box is 112 pixels. That's because the 100 pixels specified by width indicates how much area the content should take up, then 5 pixels are added on each side for padding, and 1 pixel on each side for the border.
When you change box-sizing to border-box, the calculation is done differently:
.mybox {
box-sizing: border-box;
border: 1px solid black;
padding: 5px;
width: 100px;
}This box has an actual width of 100 pixels while the space available for content is only 88 pixels (100 - 5px padding - 5px padding - 1px border - 1px border). Many consider the border-box setting to be more logical and more like how these properties should work.
There is only a problem using box-sizing when you need to support Internet Explorer 6 and 7. These browsers do not support box-sizing and so will interpret the box model properties differently.
Rule Details
Rule ID: box-sizing
This rule warns when the box-sizing property is used. The intent is to ensure that developers realize this property is not supported in older browsers such as Internet Explorer 6 and 7.
The following patterns are considered warnings:
.mybox {
box-sizing: border-box;
}
.mybox {
box-sizing: content-box;
}Further Reading
Automated linting of Cascading Stylesheets