Skip to content

Instantly share code, notes, and snippets.

@jeremenichelli
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremenichelli/a7f26e5951bfb2b77043 to your computer and use it in GitHub Desktop.
Save jeremenichelli/a7f26e5951bfb2b77043 to your computer and use it in GitHub Desktop.
box-sizing samples
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>box-sizing samples</title>
<style>
body {
text-align: center;
}
.box {
border-style: solid;
border-width: 4px;
box-sizing: content-box;
height: 150px;
padding: 35px;
margin: 30px auto 0;
width: 300px;
}
.border-box {
box-sizing: border-box;
}
.padding-box {
box-sizing: padding-box;
}
</style>
</head>
<body>
<h1>box-sizing samples</h1>
<p>
<em>All boxes have the same width, padding in border.</em>
</p>
<div class="box content-box">
box-sizing: <strong>content-box</strong>
</div>
<div class="box border-box">
box-sizing: <strong>border-box</strong>
</div>
<div class="box padding-box">
box-sizing: <strong>padding-box</strong>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment