box-sizing:content-box;
"Default. The width and height properties (and min/max properties) includes only the content. Border and padding are not included"
box-sizing:border-box;
"The width and height properties (and min/max properties) includes content, padding and border"
*{
box-sizing: border-box;
}
html {
box-sizing: border-box;
}
*,
*:before, *:after {
box-sizing: inherit;
}
*{
box-sizing: border-box;
}
box-sizing: border-box;
box-sizing: content-box;
/*content-box gives you the default CSS box-sizing behavior. If you set an element's
width to 100 pixels, then the element's content box will be 100 pixels wide, and
the width of any border or padding will be added to the final rendered width, making
the element wider than 100px.
border-box tells the browser to account for any border and padding
in the values you specify for an element's width and height. */
.div1 {
width: 300px;
height: 100px;
border: 1px solid blue;
}
.div2 {
width: 300px;
height: 100px;
padding: 50px;
border: 1px solid red;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Sintaxe formal:
content-box | (en-US) border-box
.simple {
width: 500px;
margin: 20px auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.fancy {
width: 500px;
margin: 20px auto;
padding: 50px;
border: solid blue 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Code Example |
---|
Css :: css verbinden |
Css :: dot in image css |
Css :: test typescript |
Css :: aclocal: not found |
Css :: animation not hover out |
Css :: css3 ripple loop |
Css :: css changer la couleur de la sélection |
Css :: comment in css |
Css :: rendre une div scrollable |
Css :: display: inline; |
Css :: Inline style |
Css :: #00af8f rgba gradient |
Css :: filter css |
Css :: insert checkbox into combobox css |
Css :: position absolute above everything |
Css :: how to style links in css |
Css :: how to make button appear on hover |
Css :: css animation left to right infinite codepen |
Css :: how mto change the label font style in css |
Css :: icon float right side input css |
Css :: download css from website |
Css :: responsive css template |
Css :: abc |
Css :: css hover change other element |
Css :: other children than first css |
Css :: align an entire second row center css grid |
Css :: sphinx css templates |
Css :: hoq to give paragraph color css |
Css :: redesign html select |
Css :: cabin font download |