Я изучаю html, и мой инструктор сказал нам использовать валидатор w3.org html, чтобы помочь проверить код. Я работаю с простой веб-страницей, чтобы начать, и все это отображается нормально, но когда я помещаю ее в валидатор, она дает ошибки, и я полностью в тупике.Элемент HTML Head неправильно зарегистрирован на валидаторе w3.org?
Начало моего кода
<!DOCTYPE html>
<html>
<!-- Html is the element but tag is html + the open/close tags-->
<head>
<title> Around the World Music </title>
<img src="worldmusiclogo.jpg" alt="Around the World Music logo" title="Around the World Music Logo" >
<style>
h1 {
color: red;
}
h2 {
color: orange;
}
</style>
</head>
<body>
....rest of code
Выход валидатор
Info: The Content-Type was text/html. Using the HTML parser.
Info: Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.
Error: Element style not allowed as child of element body in this context. (Suppressing further errors from this subtree.)
From line 12, column 1; to line 12, column 7
Logo" >↩↩↩<style>↩h1 {↩
Contexts in which element style may be used:
If the scoped attribute is absent: where metadata content is expected.
If the scoped attribute is absent: in a noscript element that is a child of a head element.
If the scoped attribute is present: where flow content is expected, but before any other flow content other than inter-element whitespace and style elements, and not as the child of an element whose content model is transparent.
Content model for element body:
Flow content.
Error: Stray end tag head.
From line 20, column 1; to line 20, column 7
↩</style>↩</head>↩↩<bod
Error: Start tag body seen but an element of the same type was already open.
From line 22, column 1; to line 22, column 6
↩</head>↩↩<body>↩<!--T
Кажется, проблема в том, валидатор интерпретирует код как конец головы перед <style>
. Таким образом, он считает, что стиль не в том месте, <body>
, а затем мои </head>
и <body>
теги являются посторонними. Может ли кто-нибудь указать, что я делаю неправильно?
ах .. спасибо! Исправлена моя проблема :) – BeyondThreeWoods