0

I'm using a Mac and using textedit to create a website the old fashion way. I have a HTML file and a CSS file. I cannot link the CSS with the HTML. Here is the code for my files:

HTML:

<!DOCTYPE html>
<html>
   <head>
       <link rel=“stylesheet” href=“style.css” type="text/css" media="screen">

       <title>William’s Physics Webpage</title>
   </head>

   <body>

     <div class = “nav”>
       <div class = “container”>
         <ul>
           <li> About Me </li>
           <li> Why Physics? </li>
           <li> Great Thinkers </li>
           <li> Guest Page </li>
         </ul>
       </div>
     </div>

   </body>

</html>

Here is my CSS code:

body {
    background-color:blue;
}

.nav ul {
   display:inline;
}

As you can see, the back ground is supposed to be blue due to the CSS code, but it's not. The file name for my html file is main.html while the name of my css file is style.css

4
  • Please help me link the css code to my html code. Thank you. Commented Sep 25, 2014 at 4:56
  • Your CSS file must be called style.css and it must also be in the same directory as the html file in question. Commented Sep 25, 2014 at 4:59
  • 1
    The double quotes you are using is not right “ NOT THIS ” . Use " THIS IS RIGHT " Commented Sep 25, 2014 at 5:08
  • Wait, Deepak, I don't understand what you just said. Can you clarify? Commented Sep 25, 2014 at 8:55

4 Answers 4

3

use proper " for style linking they are wrong "

<link rel="stylesheet" href="style.css" type="text/css" media="screen">
Sign up to request clarification or add additional context in comments.

Comments

0

If both of the files are in the same file directory, your code should work, unless you are trying to run it online.

Make sure to put the correct path to the file.

Comments

0

Look like media="screen" gives me some error, try media="print" or not use media at all like this:

 <link rel="stylesheet" href="style.css" type="text/css">

Or the problem is that you used “ instead of " because you copied from somewhere and it pasted wrong. Try it out.

Comments

0

Please check the file path .. If your html and css file reside at same level means it should work fine.. or else if you have placed the css file inside css folder or some folder means.. your code would be like this

 <head>
       <link rel="stylesheet" href="flodername/style.css" type="text/css" media="screen">
</head>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.