How to fix the headline row in a table using css? [closed]
Question
I made a table with no borders in the columns, and I gave 1px border only in the rows.
I have used the 'border collapsed' property and then I have given all the rows a border of 1 px.
However my problem is that the row of the headlines is a bit longer then the rest of the table?
Does anyone know how can I fix it?
Thanks in advance.
html code:
<!DOCTYPE html>
<html>
<title>web programming project 2</title>
<link rel="stylesheet" type="text/css" href="exe2CSS1.css">
<body>
<table class=outlined>
<tr id=headline>
<th class=side>Item</th>
<th class=side>Manufacturer</th>
<th class=side>Size</th>
<th class=center>Unit Price</th>
<th class=center>Quantity</th>
<th class=center>Total Price</th>
</tr>
<tr class=firstCol>
<td class=side>Corn Flakes</td>
<td class=side>Kellogg's</td>
<td class=side>18 0z</td>
<td class=center>2.5</td>
<td class=center>1</td>
<td class=center>2.5</td>
</tr>
<tr class=secondCol>
<td class=side>Solid White Tuna</td>
<td class=side>Starkist</td>
<td class=side>5 oz</td>
<td class=center>2.79</td>
<td class=center>2</td>
<td class=center>5.58</td>
</tr>
</table>
</body>
</html>
css code:
.outlined
{
font:13px Tahoma;
width: 75%;
border-collapse: collapse;
}
tr {
border: 1px solid white;
}
.secondCol{
background-color: #eeeff2
}
.firstCol{
background-color: #dfe1e7
}
.center{
text-align: center;
}
.side{
text-align: left
}
#headline{
background-color: #687291;
color: white;
}
Solution
You are missing quotes around the attributes value and you missed a closing </th>
on the first row for "Total Price" (you have a <th>
instead)
<tr id="headline">
<th class="side">Item</th>
<th class="side">Manufacturer</th>
<th class="side">Size</th>
<th class="center">Unit Price</th>
<th class="center">Quantity</th>
<th class="center">Total Price</th>
</tr>
OTHER TIPS
Hi your last tag is not closed properly "<th class=center>Total Price<th>
"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow