“Start tag head seen but an element of the same type was already open”, but I don’t have a duplicate <head>

后端 未结 1 1224
清酒与你
清酒与你 2021-01-28 12:33

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

相关标签:
1条回答
  • 2021-01-28 12:59

    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.)

    0 讨论(0)
提交回复
热议问题