Jump to content

Recommended Posts

Posted

Hello all, 

     I've recently took it upon myself to refresh my memory of html and css. I have been doing the codeacademy exercises and have moved on to try to make my own simple webpage with css from raw code, without the help of a code editor, just doing it in text until I have the basic theory down.

    Here's my problem my CSS isn't linking up properly and displaying what it should, Please tell me what little bit of code I am missing so I can link these documents up in the future, please forgive the simplicity of my question, I hope to learn a lot here as I continue to progress. Here is my code:

 

HTML (test.html):

<!DOCTYPE html>
<html>    
    <link rel="stylesheet" href="testfiles/stylesheet.css" type="text/css"/>
 
    <head>
    </head>
    <body>
        <div id="weird"></div>
        <div class="meat">This is an example of my ".meat" class</div>
        <div class="potatoes">This is an example of my ".potatoes" class</div>
        <div class="image"><img alt="Brian wearing a cheap top hat in the summertime" src="file:///C:/Users/B/Desktop/Webpage/testfiles/tophat.jpg"/></div>
        
    </body>
</html>
 
CSS(stylesheet.css):
<-- Stylesheet for Raw Code Webpage -->
 
 
<style type="text/css>
 
#weird { 
             font-family:Serif;
             background-color:blue;
             font-color:aqua;
             font-size:1.5em;
             border:2px solid aqua;
             height:200px;
             width:1000px;
#head2 {   
             font-family:Arial,serif;
             background-color:blue;
             font-color:aqua;
             font-size:1.5em;
             border:2px solid aqua;
             height:200px;
             width:auto;
            }
 
            
 
.meat  {
             font-family:sans-serif; 
             color:black; 
             background-color:red; 
             height:100px; 
             width:auto; 
             border:2px solid black; 
             font-size:1.5em;
            }
.potatoes {
             font-family:cursive; 
             color:brown; 
             background-color:tan; 
             height:100px; 
             width:auto; 
             border:2px dashed brown; 
             font-size:1.5em;}
</style>

 

::::: END CODE :::

Posted

A couple things that I immediately notice...

 

-- You need to have the link to your stylesheet within the <head> section

 

-- You don't need the <style> tags in the stylesheet. Because the styles are in a .css stylesheet, it's already clear that the content of the file is CSS. 

 

Hope that helps?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...