Hi,
This works everywhere except IE6 but needs an extra element.
Code:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.wrap {
float:left;
position:relative;
margin:50px;
}
table {
border-spacing:10px;
width:300px;
position:relative;
}
td {
border:2px solid red;
}
.wrap p {
position:absolute;
left:5px;
right:5px;
top:5px;
bottom:5px;
border:5px solid blue;
margin:0;
}
</style>
</head>
<body>
<div class="wrap">
<table cellspacing="10">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p></p>
</div>
</body>
</html>
Or if you just want Firefox and Opera support (not safari or iE) you can use less elements.
Code:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.wrap {
float:left;
position:relative;
margin:50px;
}
table {
border-spacing:10px;
width:300px;
position:relative;
}
td {
border:2px solid red;
}
table:after {
content:"";
position:absolute;
left:5px;
right:5px;
top:5px;
bottom:15px;
border:5px solid blue;
}
</style>
</head>
<body>
<div class="wrap">
<table>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</body>
</html>
Bookmarks