title: Document.write link tag
body: <p>I don't understand that error when validating my document: </p>
  
  <p>Line 14, Column 91: document type does not allow element "link" here
  …e <code>(' &lt;link rel="stylesheet" type="text/css" href="1400.css" media="screen" /&gt;');</code>
  ✉
  The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).</p>
  
  <p>One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).</p>
  
  <p>the code was:</p>
  
  <pre><code>    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; 
  &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"&gt;
  
  &lt;head&gt;
  
      &lt;title&gt;Portfolio&lt;/title&gt; 
  &lt;meta http-equiv="Content-Type" content="text/html;
      charset=UTF-8" /&gt; 
  
  &lt;link id="disabled" type="text/css" rel="stylesheet" href="disabled.css" media="screen"/&gt;
  
  &lt;script type="text/javascript"&gt;
  
      document.write(' &lt;link rel="stylesheet" type="text/css" href="1400.css" media="screen"/&gt;');
      document.write('&lt;link rel="stylesheet" type="text/css" href="1024.css" media="screen"/&gt;'); 
      document.write(' &lt;link rel="stylesheet" type="text/css" href="320.css" media="screen"/&gt;');
      document.write(' &lt;link rel="stylesheet" type="text/css" href="Ipad.css" media="screen"/&gt;');
  
  &lt;/script&gt; 
  
  
  &lt;!--[if IE]&gt;
      &lt;link rel="stylesheet" href="IE.css" media="screen"/&gt;
  &lt;![endif]--&gt;
  
  
  &lt;!--[if IE 6]&gt;
      &lt;link rel="stylesheet" href="disabled.css" media="screen"/&gt;
  &lt;![endif]--&gt;
  
      &lt;link rel="shortcut icon" href="images/favicon.png" /&gt;
  
  
  
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  </code></pre>
  
  <p><strong>What I want to know is how to fix that probleme cause I proceed this way for graceful degradation(users who have JS disabled)</strong></p>