Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Regular Coder
    Join Date
    Mar 2013
    Posts
    262
    Thanks
    4
    Thanked 67 Times in 67 Posts
    Quote Originally Posted by qim View Post
    Thank you very much for the time and trouble going over my poor code... I've only been at this one month and it shows!
    We all start somewhere.

    Quote Originally Posted by qim View Post
    I've already started to make the changes you suggested. In my html file I got rid of the <body> leaving the <body background...>

    Meanwhile, the css file starts with


    Code:
    body {
    	background-color: grey;
    	background-image: url("sea.jpg");
    	margin: 0;
    }
    
    h1, h2, h3 {
    	margin: 0;
    }
    Should I get rid of the html <body background...> Funnily enough the page displays the html "woodgrain" image and not the "sea" that is in the css
    That's because inline CSS is "more specific". For example...

    HTML:
    Code:
    <div id="red" class="blue" style="background:green;">I am green.</div>
    CSS:
    Code:
    #red {
    	background: red;
    }
    .blue {
    	background: blue;
    }
    I give that div 3 different background colors. The inline style says green. The ID says red. The class says blue. But, your background will be green because it overrides the other two. If you take out the inline style, and just put...

    HTML:
    Code:
    <div id="red" class="blue">I am red.</div>
    Your background will be red because an ID, which can only be applied to one unique element, is more specific than a class, which can be applied to numerous elements.

    Inline -> ID -> Class

    There's more to this. For example, you can override inline styles, but in any case, this will help you understand the hierarchy a bit more.
    My signature :)

  2. #17
    qim
    qim is offline
    Regular Coder
    Join Date
    Mar 2013
    Location
    Andorra
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •