...

View Full Version : Body Class in Wordpress?



FuxiAdmin
11-13-2011, 03:25 PM
Hi

Is anybody here familiar with body class in wordpress?

I have different category options on the home page of I site that I am setting up, please view: www.sugartreelondon.com

I would like to make the colour background on each of the 'more stories' bit, different for each category but cannot seem to find a way to target that element.

The line of code used for the background is;

.more_stories{background:#8f8e3e;margin:0 10px 0 10px;padding:0 0 0 0;border-bottom:1px solid #d7d7d7;font-size:0.9em;font-weight:bold;}

I thought that to target and change this I would need the code;

body.more_stories cat-item cat-item-3 {background:#fff;}

But this is not working. Can anybody help?

Thanks in advance.

Excavator
11-13-2011, 04:37 PM
Hello FuxiAdmin,
I'm not sure why the body tag is involved here.

A better approach might be specifically targeting each ul like this -


#col1 .more_stories {background: #f00;}
#col2 .more_stories {background: #00f;}

FuxiAdmin
11-13-2011, 08:00 PM
The body class is used in wordpress to change the style of particular elements throughout a site. I am getting the more_stories from the style css and am getting that categories name cat-widget 3 etc, from the source.

FuxiAdmin
11-13-2011, 08:47 PM
Exactly ignore my last post, Excavator you were absolutely right, thank you so much.

Excavator
11-13-2011, 09:24 PM
Exactly ignore my last post, Excavator you were absolutely right, thank you so much.

Cascading, targeting and precedence (http://ifyoucodeittheywill.com/2009/04/css-different-ways-to-target/).

And precedence (http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/) is always a good study.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum