html - CSS: Hover on 3 stacked images -
i'm trying build photo gallery stacked photos each album. when hover album want 1 image rotate 20 left, 1 rotate 20 right see bits of 3 images @ same time.
i think problem hover signals stuck on topmost image in stacks. i'll post have tried below. ideas? possible?
<!doctype html> <head> <title>just-css: rotate stacked images on hover</title> <style> body { background-color: black; color: white; padding: 20px; } ul { margin: 0; padding: 0; } ul li { list-style: none; position: absolute; } img { -webkit-transition: 0.2s; } img:hover.green {-webkit-transform: rotate(-20deg);} img:hover.blue {-webkit-transform: rotate(20deg);} img { border: 4px solid white; } img.red { background-color: red; } img.green { background-color: green; } img.blue { background-color: blue; } </style> </head> <body> <ul class="img-stack"> <li><img class="red" width="100" height="100" src=""></li> <li><img class="green" width="100" height="100" src=""></li> <li><img class="blue" width="100" height="100" src=""></li> </ul> </body> </html>
i know can javascript i'm playing css please no javascript :)
just change this:
img:hover.green {-webkit-transform: rotate(-20deg);} img:hover.blue {-webkit-transform: rotate(20deg);}
to this:
ul:hover img.green {-webkit-transform: rotate(-20deg);} ul:hover img.blue {-webkit-transform: rotate(20deg);}
because can activate 1 :hover
selector @ time (as far i'm aware), capture hover on parent element.
Comments
Post a Comment