2

I am trying to do some projects in my HTML book, and for one exercise I need to move embedded css to an external stylesheet before continuing on in the exercises. For some reason the external CSS is not being picked up even though in previous exercises I have never had this problem.

This is the html

<!DOCTYPE html>
<html lang="en">
<head>
<title>Lighthouse Island Bistro</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="lighthouse.css" media="screen">

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->
</head>
<body>
<div id="wrapper">
  <header role="banner">
    <h1>Lighthouse Island Bistro</h1>
  </header>
  <nav role="navigation">
<ul>
 <li><a href="index.html">Home</a></li>
 <li><a href="menu.html">Menu</a></li>
 <li><a href="map.html">Map</a></li>
 <li><a href="contact.html">Contact</a></li>
</ul>
   </nav>
  <main role="main"> 
    <h2>Locally Roasted Free-Trade Coffee</h2>
    <p>Indulge in the aroma of freshly ground roast coffee. Specialty drinks         are available hot or cold.</p>
    <h2>Specialty Pastries</h2>
<p>Enjoy a selection of our fresh-baked, organic pastries, including fresh-fruit muffins, scones, croissants, and cinnamon rolls.</p>
 <img src="lighthouseisland.jpg" width="250" height="355" id="floatright" alt="Lighthouse Island">
<h2>Lunchtime is Anytime</h2>
<p>Savor delicious wraps and sandwiches on hearty, whole-grain breads with locally-grown salad, fruit, and vegetables. </p>
<h2>Panoramic View</h2>
<p>Take in some scenery!</p>
<p>The top of our lighthouse offers a panoramic view of the countryside.     
Challenge your friends to climb our 100-stair tower.</p>
   </main> <!-- end of main content -->
   <footer role="contentinfo">Copyright &copy; 2016
   </footer>
  </div> <!-- end of wrapper -->
</body>
</html>

And the CSS

header, nav, main, footer, figure, figcaption { display: block; }
* {box-sizing: border-box; }

body { font-family: Verdana, Arial, sans-serif;
       background-color: #00005D;
}

#wrapper { background-color: #b3c7e6; 
       color: #000066;
       width: 80%;
       margin: auto;
       min-width:850px;
} 

header { background-color: #869dc7;
    color: #00005D; 
    font-size: 150%; 
    padding: 10px 10px 10px 155px;
    background-image: url(lighthouselogo.jpg); 
    background-repeat: no-repeat;
}

nav { float: right;
   width: 150px;
   letter-spacing:0.1em;
   font-weight: bold;

} 

nav ul { list-style-type: none; 
      margin: 0;
      padding: 0;
}

nav a { text-decoration: none; 
     display: block;
     padding: 20px;    
     background-color: #b3c7e6;     
     border-bottom: 1px solid #ffffff;  
     background-image: url(sprites.gif);
     background-repeat: no-repeat;
     background-position: right 0;       
}

nav a:link    { color: #ffffff;  }
nav a:visited { color: #eaeaea; }
nav a:hover   { background-color: #eaeaea;
            color: #869dc7;
            background-position: right -100px;  }

main { background-color: #ffffff;
       color: #000000;
       padding: 10px 20px;
       overflow: auto; 
} 

h1 { margin-bottom: 20px; }
h2 { color: #869dc7; 
 font-family: arial, sans-serif;
}

#floatright { margin: 10px;
         float: right;
}

footer {font-size:70%;
     text-align: center;
     padding: 10px;
     background-color: #869dc7;
     clear: both;
}

All I am trying to do at this point is get my HTML to recognize the external stylesheet so I can move on to a farther point. Any aid or guidance to finding the answer to this exercise would be greatly appreciated.

4
  • Did you try a hard refresh on browser? Sometimes these external js and css files are chached in browser's memory. Secondly are the html file and css file in the same folder? Commented Oct 11, 2017 at 17:28
  • I suppose it goes without saying, but make sure everything is spelled correctly as well Commented Oct 11, 2017 at 17:33
  • Is it not recognizing some styles or all styles? Commented Oct 11, 2017 at 17:35
  • Thanks for all the answers everyone. It works on chrome but not IE. Not sure why (im new to this language) but I assume the script at the top might have something to do with it (that was in there for the exercise) Commented Oct 11, 2017 at 17:39

4 Answers 4

1

Try opening your web browser's Developer Tools console and reloading your webpage while watching the Console panel. You might see an error that will give you a hint as to why the CSS didn't load - perhaps the file path wasn't found.

Sign up to request clarification or add additional context in comments.

3 Comments

Works in chrome but not Edge, Ill just test with chrome for the time being I suppose. Im pretty new so i guess something in that code is making IE an exemption, or its my PC
Check the Edge developer tools console as well. Glad to hear it works on Chrome, though!
when i open the edge dev tools its just a grey blank box(no code/anything showing). is there a way around that?
1

Is your stylesheet in the same folder? If its in a different folder do ./foldername/lighthouse.css

1 Comment

Its in the same folder yeah. That's why it seems so weird to me that it isnt showing up
0

Maybe you have your css inside of another Folder so you must be write on your link something like this /yourfolder/lighthouse.css

Comments

0

Forgive my ignorance if this sounds stupid, but it works in chrome but not IE(or edge). I assume there is a line of code that was in the HTML that would explain why (im pretty new to this)

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.