css - 如何在悬停超链接上设置图像旋转

标签 css image rotation

我的是这样的:

a:link {
    color: #A39B9E;
    background-color: transparent;
    text-decoration: none;
}
a:hover {
    color: #7E7E7E;
    background-color: transparent;
    text-decoration: none;
}
r {
  font-size: 10px;
  color: #7E7E7E;
}
.rotatingimg{transition: transform 2s;}

.rotatingimg:hover{transform:rotate(360deg);}
<table style="height: 20px; width: 100%;">
<tr>
<td style="width: 250px; text-align: left;"><img src="https://www.google.com/s2/favicons?domain=google.com" class="rotatingimg" style="align:right;width:15px;height:15px;border:0"> <a title="Google" href="google.nl" target="_blank">Google.nl</a></td>
</tr>
</table>


但现在当我将鼠标悬停在图像上时,只有图像在旋转。但我希望当我将鼠标悬停在链接名称上时图像会旋转。

有谁知道我在这里做错了什么以及我该如何解决这个问题?

最佳答案

在链接中包含图片。

a:link {
  color: #A39B9E;
  background-color: transparent;
  text-decoration: none;
}

a:hover {
  color: #7E7E7E;
  background-color: transparent;
  text-decoration: none;
}

r {
  font-size: 10px;
  color: #7E7E7E;
}

.rotatingimg img {
  transition: transform 2s;
}

.rotatingimg:hover img {
  transform: rotate(360deg);
}
<table style="height: 20px; width: 100%;">
  <tr>
    <td style="width: 250px; text-align: left;"> <a class="rotatingimg" title="Google" href="google.nl" target="_blank"><img src="https://www.google.com/s2/favicons?domain=google.com" style="align:right;width:15px;height:15px;border:0">Google.nl</a></td>
  </tr>
</table>

关于css - 如何在悬停超链接上设置图像旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59432286/

相关文章:

css - 我想将图像放在 Wordpress 标题中的特色内容 slider 的顶部,以便在 slider 在其下方淡入淡出时保持固定

image - OCI 运行时 exec 失败 : exec failed: container_linux. go:349: 启动容器进程导致“exec:

java - 将图像旋转 90、180 或 270 度

html - Flexbox - 垂直居中文本

html - 如何使我的包装器 <div> 垂直居中并响应?

c# - 将图像转换为字节数组

iphone - 动画旋转 UIImageView

javascript - Bootstrap Popover 不显示 popover 内容

css 定义每页的默认字体大小

IOS Phonegap 3.X : Lock page orientation during runtime