WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. jloowi
    Member
    Posted 2 years 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 2 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
    Member
    Posted 1 year ago #

    Hi jloowi,

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

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic