Does your theme’s header.php use the body_class() function?
Then you can use the classes generated by the body_class() function to target your new CSS on the new page only – with the added benefit that you can out this all in the main stylesheet – this avoiding a costly call to a second stylesheet.
For example:
body.page-id-174 #wrapper {background:#c00;}
would turn the entire wrapper div red on the page with the id of 174 only. None of the other pages would be affected.
So in other words I would be adding all of the changes I wanted to my main stylesheet and just making sure they only effect this one page?
Well one of the reasons I want a page which uses a different .css file is because I’m adding a large list of custom classes/id’s that will not be used on other pages. If I add all this to the main .css file then every page will need to load and process that info. It may not exactly be enough to truly impact the performance of the site, but it seems like such a terrible waste. It seems to me that it is more sensible to add a “costly call” to one single page than to increase the tax on every single page, post, and blog on my site.
Besides, don’t most browsers download the stylesheet again for each page they visit on the site? When I make a change to my stylesheet I can see the changes by moving to another post instead of hitting the refresh button. It seems a bit wasteful to add an extra 3,000 characters of text to each and every page-view when those lines are only needed by a page most people won’t visit. If twenty people read through twenty pages of archives, that’s an extra half-meg of download. Not exactly something to cry about, but still…
So in other words I would be adding all of the changes I wanted to my main stylesheet and just making sure they only effect this one page?
Correct.
If I add all this to the main .css file then every page will need to load and process that info.
That’s still far less “expensive” than another HTTP call to a second .css file.
don’t most browsers download the stylesheet again for each page they visit on the site?
No. The stylesheet is loaded once and then cached for subsequent pages.
No. The stylesheet is loaded once and then cached for subsequent pages.
Then why can I make a change to my stylesheet, load a new page, and see the changes? Whereas if I changed an image file I can go to a new page, come back, and it still shows that same file until I hit refresh.
You’ve configured your browser not to cache stylesheets? But I can assure you that 1 big stylesheet is better in terms of page load & performance than 2 or 3 separate sheets. Why do you think Twenty Eleven even loads the print css in the main stylesheet? It’s to avoid another http call.
Well if you say so, I’ll just have to take your word at it. It still sounds silly; this is for my links page and I can’t imagine that I will get very many views on that page, especially compared to the actual content of my site.
So for the parts that I want to alter, the context is universally body.page-id-(page name here)?
So to alter my links page it would be body.page-id-links #Part_To_Alter ?
(Forgive me if I read that wrong, still new to php and css)