Nested CSS classes - how do we do it?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Nested CSS classes - how do we do it?

Post by simonmlewis »

We have this kind of code to set the background colours of a Post in a Wordpress Blog.
But we want to make it easy to add more as they add more posts. But without adding all the other elements.
ie.

.postid-1315, .postid-4353...

So once they add a new post, I can pop in and just add another postid into the mix. but how?

Code: Select all


.postid-35126 #grve-main-content .grve-main-content-wrapper
{
 background-color: #000000;
}

.postid-35126 #grve-main-content .grve-main-content-wrapper a:hover
{
   color: #e8e8e8;
}

.postid-35126 #grve-single-post-meta-bar
{
 background-color: #000000;
display: none;
}

.postid-35126 #grve-post-breadcrumbs
{
background-color: #000000;
border-bottom: 1px solid #333333;
border-top: 1px solid #333333;
}

.postid-35126 #grve-post-breadcrumbs a:hover
{
color: #ffffff;
}


.postid-1315 #grve-main-content .grve-main-content-wrapper
{
 background-color: #000000;
}

.postid-1315 #grve-main-content .grve-main-content-wrapper a:hover
{
   color: #e8e8e8;
}

.postid-1315 #grve-single-post-meta-bar
{
 background-color: #000000;
display: none;
}

.postid-1315 #grve-post-breadcrumbs
{
background-color: #000000;
border-bottom: 1px solid #333333;
border-top: 1px solid #333333;
}
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Nested CSS classes - how do we do it?

Post by Celauran »

Is there no common class you can use? If not, can you add one? What does the associated markup look like?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Nested CSS classes - how do we do it?

Post by simonmlewis »

Those class 'numbers' are part of the <body> tag.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Nested CSS classes - how do we do it?

Post by Christopher »

simonmlewis wrote:We have this kind of code to set the background colours of a Post in a Wordpress Blog.
But we want to make it easy to add more as they add more posts. But without adding all the other elements.
If they can set specific CSS settings on an individual post basis, why not just save the styles in the DB with the post and generate a style="<?= $post['styles']; ?>" for each post?
(#10850)
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Nested CSS classes - how do we do it?

Post by simonmlewis »

Sorry?
Bear in mind this is to make it easier for me to add the css, as the person posting it cannot do this.

I want to be able to go into the CSS file in Wordpress and just add that one line of postid.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply