Title: custom css per page
Last modified: August 19, 2016

---

# custom css per page

 *  [virtuedesign](https://wordpress.org/support/users/virtuedesign/)
 * (@virtuedesign)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/)
 * I am trying to have custom css for specific pages. I have read a couple threads
   on here and have already made a new page template but i do not know how to add
   css to it and have it override my current css. For example my page template looks
   like this now
 *     ```
       <?php
       /*
       Template Name: White
       */
       ?>
   
       <?php get_header(); ?>
   
       <?php the_post(); ?>
   
       <?php get_sidebar(); ?>
   
       <?php the_content(); ?>
   
       <?php get_footer(); ?>
       ```
   
 * But i want to add css to it to have my font color black and my background color
   white. How would i go about this or am i already in the wrong direction?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759470)
 * check the usage of `body_class()`
 * [http://codex.wordpress.org/Template_Tags/body_class](http://codex.wordpress.org/Template_Tags/body_class)
 *  Thread Starter [virtuedesign](https://wordpress.org/support/users/virtuedesign/)
 * (@virtuedesign)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759474)
 * sorry still not getting me anywhere
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759484)
 * one step back to basics:
 * [http://www.w3schools.com/css/](http://www.w3schools.com/css/)
 *  Thread Starter [virtuedesign](https://wordpress.org/support/users/virtuedesign/)
 * (@virtuedesign)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759488)
 * i understand css and already have it written but it doesnt work when i add it
   to my code listed above and it didnt work when i implemented the body_class tag
   either
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759498)
 * do you use any distinct css classes or ids in your custom template?
 * (this is what for instance ‘body_class()’ would add, to make it easier to build
   custom styles)
 * there is also the possibility of conditionally linking a stylesheet in header.
   php:
 * conditional tags
    [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * for instance using the name of the page associated with your template:
 *     ```
       <?php if( is_page('page-with-white-template') ) { ?>
       <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/style-white.css" type="text/css" media="screen" />
       <?php } ?>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘custom css per page’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/custom-css-per-page/#post-1759498)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
