I have a structure as follows:
html { background-color: rgba(0, 0, 0, 0.75); } .container { margin: 10% auto; text-align: center; } div > span { display: inline-block; } .horizontal { display: inline-block; position: relative; top: .1em; width: 15%; } .bubble { display: inline-block; padding: 0.5em; background: url(http://imgh.us/Service_bubble.svg) no-repeat; background-size: contain; transition: all 0.3s ease-in-out; } .bubble:hover { transform: scale(2) rotate(-90deg); }
<!DOCTYPE html> <html> <head> <link href="//netdna.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <meta charset="utf-8"> </head> <body> <div class="container"> <div class="bubble"> <span class="fa fa-inverse fa-google fa-lg"></span> </div> <hr class="horizontal" /> <div class="bubble"> <span class="fa fa-inverse fa-facebook fa-lg"></span> </div> <hr class="horizontal" /> <div class="bubble"> <span class="fa fa-inverse fa-twitter fa-lg"></span> </div> <hr class="horizontal" /> <div class="bubble"> <span class="fa fa-inverse fa-github fa-lg"></span> </div> </div> </body> </html>
As you can see with the help of the fragment, when you hover over any icon, the bubble wrapping any icon is scaled and rotated 90 degrees to the left. (what is expected). Now I do not want to extend the rotation to children ( div > span ). They should increase, but the rotation should not occur.
Also, if possible, I would also like to extrude hr when the icon freezes and it scales. hr should shift accordingly, leaving a small margin around the bubbles.
I tried setting the following property:
div > span:hover { transform: scale(2); }
but when it falls, it scales the icon by 4 times, and the rotation is still happening.
Any ideas? I would like to rely only on CSS and would rather not include JavaScript here.
source share