Jump to content
Stef's Coding Community
bcm811

Trouble Displaying First Element On Page

Recommended Posts

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 :::

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...