how to apply css to a specific page

kaos092

New member
May 29, 2011
41
0
0
is it possible to apply css to a specific page without using a custom template?

like if i want my home page content background to be different from my news page content background is it possible without a custom template?

thanks
 


Are we talking wordpress?

If so:

Code:
<?php
if ( is_home() ) {
    body{background:yellow;}
}
?>
 
If you wrap your homepage in a new div like <div id="home">...</div>, you can specify in your css .home {background:url('image.html') #123456;}. That prevents having to use inline css.
 
Are we talking wordpress?

If so:

Code:
<?php
if ( is_home() ) {
    body{background:yellow;}
}
?>

If you wrap your homepage in a new div like <div id="home">...</div>, you can specify in your css .home {background:url('image.html') #123456;}. That prevents having to use inline css.

thanks for the replies guys

i'm using thesis at the moment and i have no page set to my static page

my homepage is fine i can do whatever i want with it no problem it's any other page that gives me trouble

none of my pages have ids only classes

for example my news page is

</style> </head> <body class="custom news"> <div id="container"> <div id="page"> <div id="header">

thesis is also different from other wordpress themes in that if
you have enabled the custom stylesheet in the Thesis options panel, the <body> tag
will be appended with the "custom" class, like so: <body class="custom">. You can use
the "custom" class to override *any* CSS declarations contained in the style.css file.

For example, if you wish to change the default link color to green, you would add the
following declarations to this file:

.custom a, .custom a:visited { color: #090; } <--- This makes links green
.custom a:hover { color: #00f; } <--- This makes links blue when you mouse over them
 
Unless I'm missing something, I would just make a copy of the page PHP file and rename it and go from there to make a new template. Shouldn't take more than a minute.

how would i make a copy of a particular pages php file?

and once i do how would i overide the old one? just delete it?
 
If you wrap your homepage in a new div like <div id="home">...</div>, you can specify in your css .home {background:url('image.html') #123456;}. That prevents having to use inline css.

This is the cleanest approach, although it would be #home in the CSS if you use id.

Might as well make use of the "cascading" aspect of CSS.