Skip to content

Instantly share code, notes, and snippets.

@DveMac DveMac/gist:2709126
Created May 16, 2012

Embed
What would you like to do?
css3 box-sizing issue
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}
.ex1 td {
width:800px;
border:5px solid red;
box-sizing: border-box;
}
.ex2 td {
width:800px;
border:5px solid red;
box-sizing: content-box;
}
table.ex3 {
width:800px;
box-sizing: border-box;
border:5px solid green;
}
table.ex4 {
width:800px;
box-sizing: content-box;
border:5px solid green;
}
div.ex5 {
width:800px;
border:5px solid blue;
box-sizing: border-box;
}
div.ex6 {
width:800px;
border:5px solid blue;
box-sizing: content-box;
}
table.ex8, table.ex7 {
table-layout:fixed;
width: 800px;
}
table.ex7 td {
width:100px;
box-sizing: border-box;
border:5px solid gray;
}
table.ex8 td {
width:100px;
box-sizing: content-box;
border:5px solid gray;
}
</style>
</head>
<body>
<table cellpadding="0" cellspacing="0" class="ex1">
<tr>
<td>
(1) td
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="ex2">
<tr>
<td>
(2) td
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="ex3">
<tr>
<td>
(3) td
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="ex4">
<tr>
<td>
(4) td
</td>
</tr>
</table>
<div class="ex5">
(5) div
</div>
<div class="ex6">
(6) div
</div>
<table cellpadding="0" cellspacing="0" class="ex7">
<tr>
<td> (7) td </td><td> &nbsp; </td><td> &nbsp; </td><td> &nbsp; </td>
<td> &nbsp; </td><td> &nbsp; </td><td> &nbsp; </td><td> &nbsp; </td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" class="ex8">
<tr>
<td> (8) td </td><td> &nbsp; </td><td> &nbsp; </td><td> &nbsp; </td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.