Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Mo Omar on
Hi, I would like to add a color to a specific content type so when creating a new post under that content type, the node will have a different color than all other nodes anywhere on the site
OR, instead of a color, how can I add a background image to that content type?
I have been reading for a couple of days to resolve this issue. Problem is I don't know anything about php, html or css. Is there an easy way?
Thanks
Comments
I think what you really mean
I think what you really mean is - how do you display a certain content type (node) in a certain color. Drupal does not store theming information (like font color) together with node data, such theming details are added/rendered in the theme layer.
Anyhow, you solution may be to add a custom css file and name it something like "node--mycontenttype.css" where "mycontenttype" is the machine readable name of your specific content type. In this css file, you can make all text of whatever color you want, or add a background image.
How to change font color or add background image? Just google for this, for example background command: http://www.w3schools.com/css/css_background.asp
In general, http://www.w3schools.com/css should provide all css code samples.
Hope this helps.
Sorry but I am a newbie.
Sorry but I am a newbie. .
Can you or anybody elaborate more?
Should I copy an already-existed file and add to it the new code? or create a file from scratch, and if so, what else should I put in the code?
Where to put the css file?
I swear I tried this method but it did not work for some reason. .
I don't know if this could help but I am using acquia marina theme.
Thanks nilashis
I am an accountant and I love drupal. I build websites for my projects
Use css
Hi moh
You can do that by css also.. Just find your node-type class from body tag of your theme , and if not then put node-type as a class on body tag.
So by selecting particular node-type class you can change color or background-image or whatever for the particular content type.
Hope this will help you.
Ankit Hinglajia
Very useful information
These are very useful information for a newbie like myself. I will have to look into these options but I may have more questions since I never played around css before.
Thank you
I am an accountant and I love drupal. I build websites for my projects