【发布时间】:2017-10-20 13:56:32
【问题描述】:
我想在悬停时在图像上放置一个说明文字。最好的方法是什么?需要js还是有css解决方案?
我有圆形图像,而不是 sn-p 中的 div。将 img 悬停会使其变大,如示例所示。
感谢您的帮助。
.circle{
width: 150px;
height: 150px;
background: yellow;
border-radius: 100%;
text-align:center;
display: inline-block;
transition: all .2s ease-in-out;
}
.circle:hover{
transform: scale(1.1);
}
<div class="circle">
</div>
<div class="circle">
</div>
<div class="circle">
</div>
【问题讨论】:
-
你可以通过 css 轻松做到这一点。那为什么是 js?
标签: javascript html css hover css-transitions