{"id":2811,"date":"2011-10-17T13:55:22","date_gmt":"2011-10-17T21:55:22","guid":{"rendered":"https:\/\/graphpaperpress.com\/?post_type=tips&p=2811"},"modified":"2011-10-17T13:55:22","modified_gmt":"2011-10-17T21:55:22","slug":"change-backgrounds-colors-fonts-on-specific-pages","status":"publish","type":"tips","link":"https:\/\/graphpaperpress.com\/tips\/change-backgrounds-colors-fonts-on-specific-pages\/","title":{"rendered":"Change Backgrounds, Colors, Fonts on Specific Pages"},"content":{"rendered":"
Open up any WordPress theme and inside the header.php file you will likely see this:<\/p>\n
<body <?php body_class(); ?>><\/pre>\nThe body_class() function is a neat little function that spits out CSS classes that make it easy to change the background color of your About page, for example. \u00a0It’s easy to find the specific CSS class to target. \u00a0Here is how you do it:<\/p>\n
View the source code of any page and search for the <body> tag. \u00a0On this page, for example, the <body> tag looks like this:<\/p>\n
<body lang=\"en\" class=\"single single-tips postid-2811 single-format-standard logged-in admin-bar browser-chrome\"><\/pre>\nThe class=”” is the part we are mainly interested in for this tip. Each one of those CSS classes (single, single-tips, postid-2811, etc.) provide us with CSS hooks to target in our stylesheet, like this:<\/p>\n
.single { background-color: black }\r\n\r\n.single-tips { background: #ededed url(http:\/\/example.com\/images\/this-is-your-background-image.jpg) repeat top left; }\r\n\r\n.postid-2811 { background-color: #ccc; }<\/pre>\nAs you can see, WordPress allows granular control over the CSS on each and every page. \u00a0Here is the scope of each class above:<\/p>\n
Pretty neat, eh? \u00a0You could even enlarge fonts, modify font colors, or really change about anything by targeting these CSS classes in your stylesheet. \u00a0For example, here is how you could enlarge paragraph fonts on single posts only:<\/p>\n
.single p { font-size: 1.2em; }<\/pre>\nIt’s easy to go overboard with this. Please don’t. Design consistency is important in web design. \u00a0That said, the body classes above will allow you do style each and every page or post differently in WordPress with a little bit of CSS.<\/p>\n","protected":false},"excerpt":{"rendered":"
Open up any WordPress theme and inside the header.php file you will likely see this: <body <?php body_class(); ?>> The body_class() function is a neat little function that spits out CSS classes that make it easy to change the background color of your About page, for example. \u00a0It’s easy to find the specific CSS class […]<\/p>\n","protected":false},"author":4765,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_acf_changed":false},"acf":[],"yoast_head":"\n
Change Backgrounds, Colors, Fonts on Specific Pages WordPress Tip | Graph Paper Press<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\t\n