Title: Changing css based on page?
Last modified: August 19, 2016

---

# Changing css based on page?

 *  [lilqhgal](https://wordpress.org/support/users/lilqhgal/)
 * (@lilqhgal)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/changing-css-based-on-page/)
 * I have a theme that I’m modifying by taking the sidebar off all pages except 
   the front page. The content width is set to 500 pixels wide. When the sidebar
   is removed, the content moves to the left, but the css is still set to 500px 
   wide. Is there a way I can create a variable to decide if the page is_front_page
   or not and to display a different div id so that I can make the width of the 
   content change to 700px if the sidebar isn’t there? Thanks!

Viewing 1 replies (of 1 total)

 *  [Edward Caissie](https://wordpress.org/support/users/cais/)
 * (@cais)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/changing-css-based-on-page/#post-1389132)
 * The `body_class()` function may be very useful for what you are trying to accomplish.
   Here is a post that explains some of its many uses: [http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/](http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/)

Viewing 1 replies (of 1 total)

The topic ‘Changing css based on page?’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [Edward Caissie](https://wordpress.org/support/users/cais/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/changing-css-based-on-page/#post-1389132)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
