[resolved] Hiding a DIV element on a specific page only (3 posts)

  1. jloowi
    Posted 3 years ago #


    I'm trying to hide a specific div element, but only on a specific page ID, and using only a line of code in the CSS stylesheet.

    In my case, I want to prevent a footer section from appearing, for instance, on page id #2.

    I tried the following code, but it doesn't work:

    #footer body.page-id-2 { display: none !important; }

    I think I'm close:

    #footer { display: none !important; }

    the last code above successfully hides the div, but it's applied everywhere. I want this to apply only to page id 2.

    Can anyone guide me?


  2. jloowi
    Posted 3 years ago #

    Ok it's a stupid fix, but here's what worked:

    body.page-id-2 #footer { display: none !important; }

    I just got the order wrong.

  3. enlazeworldwide
    Posted 3 years ago #

    Hi jloowi,

    I tried that and didn't work for me. Did you do anything additionally?


Topic Closed

This topic has been closed to new replies.

About this Topic