treehouse : what would you like to learn today?
Web Design Web Development iOS Development

CSS FILE Question ... if I have a page that doesn't need ALL the CSS as rest of site?

  • Thank you for the help. I have a general .CSS that is controlling most of my site. If on one page, I want one of the DIV tags to ignore one of it's attributes, specifically a padding-top; does that page need it's own CSS file, or can I place in the header an 'over riding" line of code? Hope this make sense. Thanks in advance.
  • @hendrix940 Nope. If you're using Wordpress, target the body ID along with the div class/ID and set the padding-top to 0. If you're not using Wordpress, just declare a body ID and go from there.

    Example
    /* 
    #about represents the body ID
    .information represents the div class
    */
    #about .information {padding-top: 0;}
  • Chris, so writing it like that, then on the 'about' page, the padding-top will be set to zero, in the information div, over ridding whatever the padding-top value is on the information div, correct?
  • And I would add the above code into the header of the page, is that right? Or would I add this code into my CSS file? Thanks.
  • @hendrix940 Yes it will override as long as it is below the CSS code that is applied to the div on all the pages. Put it in your CSS file.
  • Add it to your CSS file...it would be the easiest way and you can't forget about it.