Page 1 of 1

Nested CSS classes - how do we do it?

Posted: Thu Mar 15, 2018 5:14 am
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;
}

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

Posted: Thu Mar 15, 2018 5:53 pm
by Celauran
Is there no common class you can use? If not, can you add one? What does the associated markup look like?

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

Posted: Thu Mar 15, 2018 5:59 pm
by simonmlewis
Those class 'numbers' are part of the <body> tag.

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

Posted: Thu Mar 15, 2018 9:47 pm
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?

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

Posted: Fri Mar 16, 2018 2:48 am
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.