By ardarvin on
I'd like to override the theme style.css sheet for an individual node. How do I go about this?
Ideally I'd like to do this using only CSS, so have something like this in my node:
hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")}The problem is, how do I access the node *head*. i.e.: where do I put in the local CSS tags?
Sorry, I'm sure this gets asked a lot. I did a search but couldn't find anything.
Comments
For drupal 6? Copy node.css
For drupal 6?
Copy node.css from "modules/node/node.css" into your theme. Add an entry to your .info file for the style like so:
That will override the module css file. With your new copy, you can simply add in your selectors specific to the node.
Your node.tpl.php should output the node ID. If it doesn't, look at the default template located in "modules/node/node.tpl.php".
How would this solution work
How would this solution work for drupal 5? I would really like to know as I have been searching near and far as well!
Thanks
It is not working for me
running drupal 6
Can one prepend a path to
Can one prepend a path to node.css within the .info file such as:
I suppose I could try it and report back, huh? Maybe I'll do that... yeah. :-)
*update* Yes, it appears that we can do that. It will really help backing up my css during upgrades. Sweet :-)
The only question that I'd add to this is if there's a way to have a code block for example, auto-labelled as "code:" (no quotes) in the same manner as is done on linuxquestions.org where "code:" labels the code block.
I've really only been hardcore learning css for about two weeks now, so please bear with the thinking aloud moments.
Andrew
Try a custom CCK field
I used a CCK field for inserting custom css files. The field is a text field named css_page. Then in template.php function mytheme_preprocess_page() I added the following code:
Now anytime I want to add css for a page/node, I just put it in the cck field and it inserts the link and also does a check for IE to insert an IE css file if needed.