I don't understand how should I use box-sizing property. Because this:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div.container
{
width:10em;
border:1em solid;
}
div.box
{
box-sizing:border-box;
-moz-box-sizing:border-box; /* Firefox */
-webkit-box-sizing:border-box; /* Safari */
width:50%;
border:1em solid red;
float:left;
}
</style>
</head>
<body>
<div class="container">
<div class="box">1</div>
<div class="box">2</div>
</div>
</body>
</html>
is equivalent to this:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div.container
{
width:10em;
border:1em solid;
}
div.box
{
width:3em;
border:1em solid red;
float:left;
}
</style>
</head>
<body>
<div class="container">
<div class="box">1</div>
<div class="box">2</div>
</div>
</body>
</html>
So when should I use that property and that exactly that do? I used example from w3 http://www.w3schools.com/cssref/css3_pr_box-sizing.asp
See Question&Answers more detail:os