an
groups-icon

How to target specific pages with CSS in WordPress

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    J V
    0 points
    Beginner

    Hi all,

    Maybe this isn’t news for some of you, but I just learned this little trick today.

    Turns out the unique page id of every page in a wordpress theme can be used as a CSS class.

    Basically, this is extremely useful for targeting specific elements on specific pages (vs sitewide) when making CSS changes to a child theme, etc.

    Example:

    .page-id-51 #header {
    background-color: blue;
    }

    This would make a blue header ONLY on a page with the wordpress id : 51

    Here’s a link to the article where I learned this:

    WordPress Quick Tip: Target a specific page with CSS

    Good Luck

    September 1, 2017 at 6:23 am
  • James D
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 1, 2017 at 6:47 am
  • J V
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 2, 2017 at 5:36 am

671

Views

2

Replies