Forums

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

  1. jloowi
    Member
    Posted 8 months ago #

    Hello,

    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?

    Thanks!

  2. jloowi
    Member
    Posted 8 months 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.

Reply

You must log in to post.

About this Topic