News for hackers. Stuff that matters.
Re:Content Based CSS by Domenic_S on Wednesday May 09, 2012 @01:22PM (#3949554)
Wait, what am I missing?

<p><span class="fast">Red text</span></p>

with

p span.fast { color: red; }

will work just fine.

Edit: oh, I get it. You want the entire <p> tag to be red when the span starts part way through. Why not put a class on the <p>? It seems crazy counterintuitive to select elements backwards like that.

Re:Content Based CSS by clintjhill on Wednesday May 09, 2012 @01:40PM (#3949634)
Yes in trivial cases you might put a class on the P element. But what about when you have dynamic updates to the DOM? If I have 15 P elements in a collection and not all have content (think of a discussion thread and comments) - how would I specify which P elements to style vs. those I don't want styled?

The ability to style based on content of the selector is powerful in this case.