我们先来看下效果:
(推荐教程:CSS教程)
html代码:
立即学习“前端免费学习笔记(深入)”;
这是是pic-1这是是pic-2这是是pic-3
登录后复制
css代码:
html { box-sizing: border-box; font: 18px PT Mono; background: antiquewhite;}*,*::before,*::after { box-sizing: inherit;}body { display: flex; align-items: center; justify-content: center; flex-direction: column; width: 100%; height: 100vh;}.box { width: 25%; min-width: 250px; display: block; height: 50px; position: relative; border-radius: 5px; background: linear-gradient(to right, #abbd73 35%, #d6e2ad 100%); margin-bottom: 40px; padding: 15px 25px 0 40px; color: darkslategray; box-shadow: 1px 2px 1px -1px #777; transition: background 200ms ease-in-out;}.shadow { position: relative;}.shadow:before { z-index: -1; position: absolute; content: ""; bottom: 13px; right: 7px; width: 75%; top: 0; box-shadow: 0 15px 10px #777; -webkit-transform: rotate(4deg); transform: rotate(4deg); transition: all 150ms ease-in-out;}.box:hover { background: linear-gradient(to right, #abbd73 0%, #abbd73 100%);}.shadow:hover::before { -webkit-transform: rotate(0deg); transform: rotate(0deg); bottom: 20px; z-index: -10;}.circle { position: absolute; top: 14px; left: 15px; border-radius: 50%; box-shadow: inset 1px 1px 1px 0px rgba(0, 0, 0, 0.5), inset 0 0 0 25px antiquewhite; width: 20px; height: 20px; display: inline-block;}
登录后复制
以上就是利用css实现鼠标悬停效果的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2884970.html