I'm playing around with HTML tables, the th
with colspan=3
shouldn't have border top and bottom but it does. What is the reason?
I've removed the borders all together with border: 0px solid black
.
I've also created this fiddle.
Screenshots:
PS: I know tables should not be used for layouts I'm just trying to learn how tables work.
Update:
I know that when I don't use border-collapse: collapse
, these extra borders do not show up, but need to use border-collapse
for the rest of my table.
<!doctype html>
<html>
<head>
<style>
html,body {height: 100%;
margin:0;
padding: 0px;
}
table {width: 100%;
height: 100%;
}
table, td, th, .box{ border:0px solid black;
border-collapse: collapse;
padding: 0;
}
.main {width: 980px;
margin: 0px auto;
border-width: 1px;}
/* header */
.main .header { height: 150px;
border-bottom-width: 1px;}
.main .header td{ width: 150px;
vertical-align: top;}
.main .header td img {float: right;}
.main .header td img[src*='flag'] {margin: 5px 3px 0px 4px;}
/* header */
/* Nav */
.main .nav {
height: 32px;
border-bottom-width: 1px;}
.main .nav th {
width: 25%;
border-right-width: 1px;
}
.main .nav th:nth-last-child(1) {
border-right-width: 0px;
}
.main .nav th:first-letter{ text-transform: uppercase;
color: red;}
.main .nav th:hover { background-color: black;
color:white;}
/* Content */
.main .Content {
padding: 70px 130px 20px;
}
.main .Content td {
width: 300px;
height: 300px;
border-width: 1px;
}
</style>
</head>
<body>
<table class="main">
<tr>
<td class="header">
<table>
<tr>
<td><img src="image/logo.jpg"></td>
<th>Site Name</th>
<td><img src="image/flag-nl.png" /><img src="image/flag-us.png" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="nav">
<table>
<th>Product</th>
<th>Support</th>
<th>services</th>
<th>about us</th>
</table>
</td>
</tr>
<tr>
<td class="Content">
<table>
<tr>
<td>1</td>
<th>2</th>
<td>3</td>
</tr>
<tr><th colspan="3"> </th></tr>
<tr>
<td>1</td>
<th>2</th>
<td>3</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</pre>