头闻号

宁海县佳韵塑料厂

综合性公司

首页 > 新闻中心 > 科技常识:纯CSS3制作的鼠标悬停时边框旋转
科技常识:纯CSS3制作的鼠标悬停时边框旋转
发布时间:2024-09-22 01:41:49        浏览次数:3        返回列表

今天小编跟大家讲解下有关纯CSS3制作的鼠标悬停时边框旋转 ,相信小伙伴们对这个话题应该有所关注吧,小编也收集到了有关纯CSS3制作的鼠标悬停时边框旋转 的相关资料,希望小伙伴们看了有所帮助。

下面以2017年新年祝福语为例给大家展示下效果。

纯CSS3实现的鼠标悬停时边框旋转的效果:

实现代码如下 代码中注释已经比较详细 就不再多说了:

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>document</title> <style type="text/css"> body { width: 40rem; height: 30rem; font-size: 62.50%; } .container { width: 100%; height: 100%; background: #0f0; text-align: center; } .content { display: inline-block; margin-top: 5rem; width: 20rem; height: 20rem; border: solid 15px rgba(255, 255, 255, 1); border-radius: 50%; box-sizing: border-box; transition: all 2s; } .content:before { display: inline-block; width: 100%; height: 100%; border-radius: 50%; box-sizing: border-box; content: ''; } .content:hover { } .content:hover:before { border: dashed 30px #fff; animation: whirl 9s linear infinite; } .con-text { margin: -60% auto; width: 80%; font-size: 3rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } @keyframes whirl { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } </style></head><body> <section class="container"> <div class="content" title="新年好新年好新年好"> <p class="con-text">新年好新年好新年好</p> </div> </section></body></html>

以上所述是小编给大家介绍的纯CSS3制作的鼠标悬停时边框旋转 希望对大家有所帮助 如果大家有任何疑问请给我留言 小编会及时回复大家的。在此也非常感谢大家对爱蒂网站的支持!

来源:爱蒂网