Rachel Katz
Rachel Katz

Reputation: 23

HTML not linking with CSS properly

So I have this HTML code and I ran it through an HTML validation site and it says that I didn't close the "head" section and as a result none of the CSS code I wrote is affecting the text on the page. The link to the CSS file is definitely the right path but I just can't figure out why the code isn't seeing that I closed the "head".

If it helps at all I'm using Dreamweaver CS6 to edit my code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <link rel="stylesheet" type="text/css" href="Index_Stylesheet.css" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Index</title>
</head>

<body>

<!--navigation bar-->
 <div class="nav">

    <div class="name">
          <ul class="pull-left">
            <li><a href="#">ANDREW SHAPIRO</a></li>
      </ul>
    </div>

    <div class = "etc"> 
      <ul>
          <li><a href="#">About</a></li>
          <li><a href="#">News</a></li>
          <li><a href="#">Commercial</a></li>
          <li><a href="#">Listen</a></li>
          <li><a href="#">iTunes</a></li>
          <li><a href="#">Images</a></li>
          <li><a href="#">Store</a></li>
          <li><a href="#">Contact</a></li>
          <li><a href="#">Email List</a></li>
        </ul>
    </div>

</div>
</body>
</html>

Thank you for taking the time to read this!

Upvotes: 1

Views: 83

Answers (2)

Zahid Saeed
Zahid Saeed

Reputation: 1171

First of all try to use the HTML5 document type declaration cause it's much easier to understand and makes your code more readable.
Secondly try to put<meta> tag at first, then put the <title> tag and then in last put your <link> tag

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Your Website Title</title>
    <link rel="stylesheet" href="Path to the stylesheet">
  </head>
  <body>
    <!--
      Your HTML code goes here...
    -->
  </body>
  
</html>

If it still not works, make sure that the file is in the correct path. Since you are using dreamweaver it's really easy to check whether the file has been linked or not. Once you link a css file with your document, it attaches itself with the source code file. If it does not show up, press the F5 key if your using computer or Fn + F5 if your using laptop to refresh the dreamweaver workspace.


enter image description here

Once the css file has been showed up, go ahead and click it, if it shows your code then you are ready to go! Otherwise if it shows this error then it means that your css has not been properly linked.

enter image description here

Upvotes: 1

kschmit90
kschmit90

Reputation: 528

Try removing the / from the link declaration and the meta declaration.

<link rel="stylesheet" type="text/css" href="Index_Stylesheet.css"> </link>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

OR

<link rel="stylesheet" type="text/css" href="Index_Stylesheet.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

See if that changes anything, hope it helps.

Upvotes: 0

Related Questions