Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS transition transform

I would like to ask if there's a way to only rotate the icon when the mouse is over the whole text?

Code looks like this:

.text .icon {
  vertical-align: middle;
  font-size: 40px;
  
  transition: transform 0.5s;
}

.icon:hover {
  transform: rotate(360deg);
}

.text {
  margin: 0 auto;
  clear: both;
  font-size: 23px;
}
<p class="text">
  <span class="icon">i</span><a href="#" target="_blank">Text</a>
</p>

The icons spins, but only with mouse over itself.

Thanks

like image 568
senfrakete Avatar asked Dec 09 '25 18:12

senfrakete


1 Answers

You can use .text:hover .icon as the selector and it will rotate when hovering over the p element.

like image 188
Sami Kuhmonen Avatar answered Dec 11 '25 11:12

Sami Kuhmonen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!