I have an to write a selector similar to:
div#content > section (.left > img) + .left
but obviously the parenthesis are ignored. How should I rewrite this? Or it isn't possible in plain CSS?
I have an to write a selector similar to:
div#content > section (.left > img) + .left
but obviously the parenthesis are ignored. How should I rewrite this? Or it isn't possible in plain CSS?
No, you can't select something in CSS based on what it contains, which is essentially what you are attempting in the parentheses.
What your trying to do is not possible at least not as of the latest css3 spec.
If your not wanting to add via the server, maybe a bit of jQuery?
See this fiddle as it does what you want very easily
http://jsfiddle.net/4qZpc/2/embedded/result/ - results!
Grab the code: http://jsfiddle.net/4qZpc/2/
How about giving the section an id (assuming you have multiple sections) and then doing something like:
#content-section img + .left
I'm not entirely sure what effect you're trying to achieve here, but if there isn't a particular case where a .left element directly follows an img other than here, you should be safe.
Alternatively, if you have nested .left elements, you could do:
#content-section img + .inner-left
You'd have to add server-side an .image_in_it
class on each element with .left
class if it contains an img element.
<div id="content">
<section>
<div class="left image_in_it">
<img src="" alt="">
</div>
<div class="left">
</div>
</section>
</div>
and then div#content > section > .left.image_in_it + .left
would select any .left
directly following .left.image_in_it