css实现鼠标悬浮文字多种背景动画效果代码
代码语言:html
所属分类:悬停
代码描述:css实现鼠标悬浮文字多种背景动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> .mouse-out { position: relative; transition: 0.3s; color: #fff; } .mouse-out:hover { color: #000; } .mouse-out::before { content: " "; background: #fff; display: block; position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0 0 0 0; z-index: -1; transition: transform 0.3s; transform: scale(0, 1); transform-origin: bottom right; } .mouse-out:hover::before { transform: scale(1, 1); transform-origin: bottom left; } .mouse-out.mouse-out-left::before { transform: scale(0, 1); transform-origin: bottom left; } .mouse-out:hover.mouse-out-left::before { transform: scale(1, 1); transform-origin: bottom right; } .mouse-out.mouse-out-up::before { transform: scale(1, 0); transform-origin: top left; } .mouse-out:hover.mouse-out-up::before { transform: scale(1, 1); transform-origin: bottom left; } .mouse-out.mouse-out-down::before { transform: scale(1, 0); transform-origin: bottom left; } .mouse-out:hover.mouse-out-down::before { transform: scale(1, 1); transform-origin: top left; } p { padding: 0.1em 0.3em 0.2em; font-size: 2.5rem; margin: 0; } .nav { display: flex; font-size: 1.2rem; } .nav a { padding: 0.1em 1.5em 0.2em; text-decoration: none; } section { position: relative; z-index: 0; display: flex; width: 100%; height: 100%; justify-content: center; align-items: center; text-align: center; } section:nth-of-type(1) { background-color: #0f4f68; } section:nth-of-type(1) p:hover { color: #0f4f68; } section:nth-of-type(2) { background-color: #2a9d8f; } section:nth-of-type(2) p:h.........完整代码请登录后点击上方下载按钮下载查看
网友评论0