Как исправить строку заголовка в таблице с помощью css?[закрыто]
Вопрос
Я создал таблицу без границ в столбцах, и я установил границу в 1 пиксель только в строках.
Я использовал свойство 'border collapsed', а затем присвоил всем строкам границу в 1 пиксель.
Однако моя проблема в том, что строка заголовков немного длиннее, чем остальная часть таблицы?
Кто-нибудь знает, как я могу это исправить?
Заранее благодарю.
html - код:
<!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-код:
.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;
}
Решение
У вас отсутствуют кавычки вокруг значения атрибутов, и вы пропустили закрытие </th>
в первой строке для "Общей цены" (у вас есть <th>
вместо этого)
<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>
Другие советы
Привет, ваш последний тег закрыт неправильно "<th class=center>Total Price<th>
"
Не связан с StackOverflow