...

View Full Version : Nested elements CSS - alternative?



Krupski
02-24-2011, 02:50 PM
Hi all,

Currently, I have some CSS to produce alternating background colors for NESTED blockquotes... like this:


blockquote,
blockquote blockquote blockquote,
blockquote blockquote blockquote blockquote blockquote {
background-color: #dddddd;
}

blockquote blockquote,
blockquote blockquote blockquote blockquote,
blockquote blockquote blockquote blockquote blockquote blockquote {
background-color: #eeeeee;
}...and it works, but it seems complicated and messy. Is there a simpler, cleaner alternative to get the effect I want?

Thanks!

-- Roger

abduraooft
02-24-2011, 03:46 PM
Is there a simpler, cleaner alternative to get the effect I want? You may add separate classes on the blockquotes, say calss="even" or class="odd" and use class selectors, like

blockquote.odd{

}
blockquote.even{

}
But, why do you need nested blockquotes?

Krupski
02-25-2011, 01:54 PM
You may add separate classes on the blockquotes, say calss="even" or class="odd" and use class selectors, like

blockquote.odd{

}
blockquote.even{

}But, why do you need nested blockquotes?

Thanks for the reply... but unfortunately I don't have the option to use odd and even.

As far as nesting quotes, it can happen if a quoted post is quoted again.... like this:




It looks blue to meSorry I disagree, it's green!You are both wrong! It's RED!

See? There's no way for the quote BBCode to know how many previous quotes are inside it... therefore I can't use even and odd.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum