Back in 2008, Shaun Inman suggested the syntax: [Corrected the following sentence]: In this example, it would select a tags but only if they contained an img tag.
If you want to achieve this using jQuery here is the reference for the jQuery parent selector. Until this exists, solutions like the one above are what we must resort to in order to compensate. this potentially has the benefit of clarifying things like pseudoclasses, a:hover < img seems to indicate the img style will change when the child a is hovered, moreso than img < a:hover. Top 10 Projects For Beginners To Practice HTML and CSS Skills. Change an HTML5 input's placeholder color with CSS, CSS selector for first element with class.