@jamy_za I think he wants to get the .black-box class, and I cannot for the life of me remember how to go back levels in CSS, as < doesn't seem to be working...
@jamy_za well then, the JS solution I just posted is the only way, I should imagine. I understand not ideal, but if the HTML needs to be laid out in that way, then it is his only option.
I have a written a code in CSS for displaying image with text with transition effect.. the code is something like this
/*******HTML*********\
/*******CSS*********\
"class=black-box" i am using like a light box effect
now i want to control
"ul li:hover with .black-box", how can i use that?? any idea
@dhiruSingh Please post your code on http://codepen.io and paste the URL here.
@chrisburton... here is the "http://codepen.io/dhiruSingh/pen/fkhuC"
I have no idea what you're trying to do. Are you trying to target the parent element here?
@jamy_za I think he wants to get the .black-box class, and I cannot for the life of me remember how to go back levels in CSS, as < doesn't seem to be working...
I mean with jQuery it would be easy, and I don't do JS.
Here it is working
@alexmccabe You can't go up or back in CSS. Perhaps that answers his question :p
http://www.w3.org/TR/CSS2/selector.html#pattern-matching http://css-tricks.com/child-and-sibling-selectors/
A solution could be, change the markup to work with CSS, or use JS.
@jamy_za well then, the JS solution I just posted is the only way, I should imagine. I understand not ideal, but if the HTML needs to be laid out in that way, then it is his only option.
Unless some CSS magician lives here.
@jamy_za.. i want to control parent element with child element.. can i???
@alexmccabe ... i want to use pure CSS for that.. if there is only JS solution then i think must go with JS...
CSS doesn't provide any way to select a parent element. You can target children or siblings, nothing else.
The best you can do in your case is
black-box:hover ~ ul liwhich is -I guess- not what you were asking for.@hug... my req is little bit tricky... :P
No, it's impossible with CSS. Javascript is the solution.