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
This reply is for PremiumPress customers only.
671
Views
2
Replies
Copyright © 2010-2026 PremiumPress Limited.
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:
Good Luck
Members Only Content
This reply is for PremiumPress customers only.
Login NowMembers Only Content
This reply is for PremiumPress customers only.
Login Now