Support » Themes and Templates » applying css to a specific page

  • how would i go about applying custom css styles to a specific page?

    when I view my page source they have no “id” only “class”

Viewing 10 replies - 1 through 10 (of 10 total)
  • sorry i mean my body tag has no id only class

    for general styling, there is no difference between css id and css class – in terms of specificity. http://www.w3schools.com/css/css_id_class.asp

    for instance, the page specific css class output by body_class() .page-id-237 is unique to one page, and you can build your page css on it.

    I’m sorry i’m confused

    maybe you could give me an example i can test out?

    my news page class is <body class=”custom news”>

    what would i do to style it?

    forgot to mention i’m using thesis so the <body> tag
    will be appended with the “custom” class, like so: <body class=”custom”>.

    start all the custom styles for your news page with:
    .custom.news

    example:

    .custom.news .hentry h2 { ... }

    without a link to your site and a specific example, this is all i can suggest.

    well my site has a coming soon page so unfortunately i can’t give a link

    but what i want to do is change the background that my content is posted on and to make it a certain color only on the news page

    i did it on my home page with this code

    .custom #content {
    background: #f8f8f8;

    but this code changes it on every page

    Without a link to you site is hard, but lets try it.

    first make your that you them has the <?php body_class()?> function in the body tag.

    This will add a unique class to the page something like “page-id”, “post-ID” then you can target this class like .page-id #content {}

    *sigh* i’m so confused :X

    what do you want me to do with <?php body_class()?>

    i’m assuming put it in my custom functions.php?

    then what do you want me to put in the ()? the news page id?

    i’m not using a custom page template so i didn’t design any pages from scratch so the only place to add code is either custom functions.php or custom.css

    <?php body_class()?> doesn’t work i got fatal syntax error in my custom functions.php

    i am thinking you dont know HTML , somewher in your header.php you will find <body> after body and within the > add the funtion that i gave you this will add page specifc html or just add a link to the page this will help us a lot to be able to help

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘applying css to a specific page’ is closed to new replies.