How can I customize a CSS framework for specific pages in WordPress?

I’m trying to customize the framework.css for how high or low the sidebar appears on specific pages. Would it be possible to do this using a custom page template and a specific div class declaration? Such as creating a custom template and within that template creating a class to “override” the default css sidebar element settings for those pages? How would I go about doing this?

Related posts

Leave a Reply

2 comments

  1. One option is to make sure the theme is using the function body_class() inside the <body> tag.

    When I select the page template Sidebar Template (wp-content/themes/twenty-eleven/sidebar-page.php), the class page-template-sidebar-page-php shows up in the body tag:

    enter image description here

  2. According to brasofilo’s answer, every page has its own class, in case of brasofilo’s code, it is the page-id-674. It’s generated by wordpress in general.

    If you want to do styling on specific pages, you may use something like this:

    body.page-id-674 div.specific-div-class {
      /*code*/
    }
    

    Hope that helps!