Error: document type does not allow element "link" here

Hi,

I am validating my form at http://validator.w3.org

and its flagging up with this error: “document type does not allow element “link” here”

Would you please help me to find as exactly what the problem is…and how this can be rectified…

Thanks in advance.

You would need to show us your code or a link to your site so that we can help. Otherwise “a link here” doesn’t mean anything.

Without being able to see your page, we’re kind of shooting in the dark here, but at a guess, I would say that <link> elements are only allowed within the <head>…</head> section of a web page, so if you have <link> elements outside that, that could be what’s giving you grief.

Are you using an HTML doctype declaration and XML-style self-closing tags? That will fail. For instance, this,

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
  <p>Hello, World!</p>
</body>

is equivalent to this, which is obviously invalid,

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
>
  <link rel="stylesheet" type="text/css" href="style.css">>
</head>
<body>
  <p>Hello, World!</p>
</body>
</body>

For HTML you should use this,

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
  <p>Hello, World!</p>
</body>

Thanks, AutisticC,

You’re right…I was putting that into the body…Its working fine now…

Thanks a lot.