css实现悬浮下划线动画显示效果代码
代码语言:html
所属分类:悬停
代码描述:css实现悬浮下划线动画显示效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { height: 100vh; width: 100vw; overflow: hidden; display: grid; justify-content: center; align-content: center; background: #fff; } body ul { list-style-type: none; background: #1155cb; padding: 30px 80px 40px 90px; border-radius: 5px; box-shadow: 0 40px 30px -20px rgba(0, 0, 0, 0.25); } body ul li { text-align: left; position: relative; } body ul li:hover:after { box-shadow: 0 0 0 5px #1155cb, 0 0 0 7px #e0ff00; } body ul li:after { content: ""; position: absolute; width: 7.5px; height: 7.5px; background: #c2ff00; border-radius: 100%; left: -25px; top: 50%; transform: translate(0, -50%); box-shadow: 0 0 0 0 #1155cb, 0 0 0 0 #e0ff00; transition: 0.4s ease-in-out; } body ul li:nth-of-type(2) a:before { bottom: -50px; transform-origin: left; } body ul li:nth-of-type(2) a:hover:before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200%25' height='100%25'%3E%3Cdefs%3E%3Cstyle%3E .wave%7B animation:wave 2s cubic-bezier(0.175, 0.885, 0.32, 1) infinite; animation-delay:-0.25s; stroke:%23e0ff00; stroke-width:2; stroke-linecap:square; %7D @keyframes wave%7B 25%25%7B d:path('M 0 20 L 10 15 L 20 20 L 30 25 L 40 20 ');%0A%7D%0A50%25%7B%0Ad:path('M 0 20 L 10 25 L 20 20 L 30 15 L 40 20 ');%0A%7D%0A75%25%7B%0Ad:path('M 0 20 L 10 15 L 20 20 L 30 25 L 40 20 ');%0A%7D %7D %3C/style%3E%3C/defs%3E%3Cpattern id='wavePattern' x='0' y='0' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath fill='none' class='wave' d='M 0 20 L 10 25 L 20 20 L 30 15 L 40 20' /%3E%3C/pattern%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='url(%23wavePattern)'%3E%3C/rect%3E%3C/svg%3E") 0px 50%/40px 40px repeat-x; animation: waving 6s linear infinite reverse; transform-origin: right; } body ul li:nth-of-type(3) a:before { transform-origin: right; width: calc(100% + 25px); } body ul li:nth-of-type(3) a:hover:before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200%25' height='100%25'%3E%3Cdefs%3E%3Cstyle%3E .wave%7B animation:wave 2s linear infinite; animation-delay:0s; stroke:%23e0ff00; stroke-width:2; stroke-dashoffset:0px; stroke-dasharray:80px; stroke-linecap:round; fill:%231155cb; %7D @keyframes wave%7B 25%25%7B stroke-dashoffset:-80px; %7D 50%25%7B stroke-dashoffset:-80px; %7D 100%25%7B stroke-dashoffset:-160px; %7D %7D %3C/style%3E%3C/defs%3E%3Cpattern id='wavePattern' x='0' y='0' width='80' height='80' patternUnits='userSpaceOnUse'%3E%3Cpath class='wave' d='M 0 40 L 50 40 L 80 40 L 54 44 L 54 36 L 80 40 ' /%3E%3C/pattern%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='url(%23wavePattern)'%3E%3C/rect%3E%3C/svg%3E") calc(100% - 10px) 50%/40px 80px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200%25' height='100%25'%3E%3Cdefs%3E%3Cstyle%3E .wave%7B stroke:%23e0ff00; stroke-width:2; stroke-linecap:round.........完整代码请登录后点击上方下载按钮下载查看
网友评论0