I am validating my web page code in the W3Schools and it keeps giving me this error message:
Error: Start tag
head
seen but an element of the same type was already open.
From line 5, column 1; to line 5, column 6"utf-8">↩↩<head>↩<style>
I have checked through my code and I can't see where I have made a duplicate of a head tag, can someone help me out please?
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<style>table,th, td{border:1.5px solid red;} td{ padding: 15px;}</style>
<title> Index </title>
</head>
<body>
<h1> Online store for cheese </h1>
<table style="width:100">
<tr>
<th>Cheese name</th>
<th>Origin</th>
<th>Years to age</th>
</tr>
<tr>
<td><a href="https://www.thecheeseworks.co.uk/old-amsterdam"> Gouda </a> </td>
<td> Netherlands</td>
<td> 1</td>
</tr>
<tr>
<td> <a href="taleggio.html">Taleggio</a></td>
<td> Italy(Lombardy)</td>
<td> 6-10 weeks </td>
</tr>
<tr>
<td>Parmigiano-Reggiano</td>
<td>Italy</td>
<td> 1</td>
</tr>
<tr>
<td>Manchego</td>
<td>Spain</td>
<td> 60 days to 2 years</td>
</tr>
<tr>
<td>Monterey Jack</td>
<td>USA</td>
<td> 1 month</td>
</tr>
<tr>
<td>Cheddar </td>
<td>England</td>
<td> 1</td>
</tr>
<tr>
<td>Emmental</td>
<td>Switzerland</td>
<td> 4 months</td>
</tr>
</table>
</body>
</html>
In your third line you have a <meta charset="utf-8">
before your <head>
start tag. Having a meta element after the <html>
start tag automatically opens the head element before the meta element, which causes your explicit <head>
tag to be detected as a duplicate.
Simply move your <meta charset="utf-8">
underneath the <head>
tag to resolve this error:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>table,th, td{border:1.5px solid red;} td{ padding: 15px;}</style>
<title> Index </title>
</head>
(You can also remove the <head>
tag entirely and it would validate, too, but having a </head>
end tag without its start tag looks funny, even if the start tag isn't strictly necessary.)
来源:https://stackoverflow.com/questions/35394512/start-tag-head-seen-but-an-element-of-the-same-type-was-already-open-but-i-do