2017-04-18 11 views
1

안에 표시됩니다. 다음 html이 잘못 해석되었습니다.<Head>이 (가) <body>

크롬 디버그 도구를 사용하면 <head><body> 안에 표시됩니다.

왜 그런 일이 발생합니까? 코드 :

<!DOCTYPE html> 
<html> 
<hed> 
    <meta charset="utf-8"/> 
    <link href="_css/style.css" rel="stylesheet" /> 
    <title>Position test</title> 
</hed> 
<body> 
    <div class="block"> 
     <p>this p inside a div</p> 
    </div> 
    <table> 
    <tr> 
     <td><p>this p inside td</p></td> 
     <td></td> 
     </tr> 
    </table> 
     <div class="table"> 
     <p>this p inside a div displayed as a table</p> 
    </div> 
</body> 
</html> 

결과 : 당신은 머리 태그에 오류가 있기 때문에 https://zoharch.github.io/position/index.html

+4

당신은'head' 대신'hed'라고 철자를 잘못 입력 했습니까? 아니면 정말로 당신의 코드입니까? – Swellar

답변

2

<hed><head> </hed>이 있어야 할 수 있어야 </head>

HTML

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"/> 
    <link href="_css/style.css" rel="stylesheet" /> 
    <title>Position test</title> 
</head> 
<body> 
    <div class="block"> 
     <p>this p inside a div</p> 
    </div> 
    <table> 
    <tr> 
     <td><p>this p inside td</p></td> 
     <td></td> 
     </tr> 
    </table> 
     <div class="table"> 
     <p>this p inside a div displayed as a table</p> 
    </div> 
</body> 
</html> 
3

당신의 철자가 머리에 맞지 않습니다. 너는 헷을 썼다.

이 될 것입니다 :

<head></head> 
0

그냥이 머리를 붙여 복사하여 다음과 같이해야하며 OK :) 될 것

<head> 
    <meta charset="utf-8"> 
    <link href="_css/style.css" rel="stylesheet"> 
    <title>Position test</title> 
</head> 
1

그것은 <hed> 태그 때문에 (<head>의 오자를) 발생 가 인식되지 않기 때문에 브라우저는 알 수없는 유형의 hed 요소를 시작하는 것으로 간주합니다. head 요소에는 이러한 요소가 허용되지 않으므로 브라우저는 body 요소의 시작을 의미하며 나머지는 문서에 모두 포함됩니다. 이 전에는 비어있는 head 요소를 의미합니다.

대부분의 경우 HTML 문서를 headbody 요소로 나누는 것은 구문 적이며 "철학적"이므로 대부분의 경우이 내용이 중요하지 않습니다. meta, linktitle 요소는 브라우저에서 해당 요소를 body 내부로 처리하지만 실제로는 정상적으로 작동합니다. 물론 <head></head> 태그의 철자 오류를 수정해야합니다.