Tuesday 28 November 2017

xhtml - CSS Parent/Ancestor Selector












I
know this is a shot in the dark, but is there a way, using css only, CSS2, no jquery, no
javascript, to select and style an element's ancestor? I've gone through the selectors
but am posting this in case I missed something or there is a clever
workaround.



For example, say I have a table with
classname "test" nested inside a div. Is there some sort
of:




class="test">





class="lang-js prettyprint-override">div (with child)
.test
{
/*styling, for div, not .test
...*/
}

class="post-text" itemprop="text">
class="normal">Answer



There is
no such thing as parent selector in CSS2 or CSS3. And there may never be, actually,
because the whole "Cascading" part of CSS is not going to be pretty to deal with once
you start doing parent selectors.



That's what
jQuery is for :-)


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...