Treehouse: Grow your CSS skills. Land your dream job.

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

  • # September 4, 2012 at 6:15 am

    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.

    # September 4, 2012 at 6:19 am

    @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.


    #about represents the body ID
    .information represents the div class
    #about .information {padding-top: 0;}
    # September 4, 2012 at 6:41 am

    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?

    # September 4, 2012 at 6:47 am

    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.

    # September 4, 2012 at 7:00 am

    @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.

    # September 4, 2012 at 7:01 am

    Add it to your CSS file…it would be the easiest way and you can’t forget about it.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.