鼠标文字悬浮显示圆形图片效果

代码语言:html

所属分类:悬停

代码描述:鼠标文字悬浮显示圆形图片效果

代码标签: 显示 圆形 图片 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
@import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@900&display=swap");
* {
  box-sizing: border-box;
}
*::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Work Sans', sans-serif;
  font-size: 1em;
  margin: 0;
  background: #f2f0ed;
  overflow: hidden;
}

.container {
  position: relative;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  width: 100%;
  min-height: 100vh;
}

a {
  text-decoration: none;
}

.link {
  z-index: 1;
  position: relative;
  display: inline-block;
  font-size: 3em;
  color: #808080;
  text-transform: uppercase;
  -webkit-transition: color 275ms ease;
  transition: color 275ms ease;
}
.link:hover {
  color: #333;
}
.link:hover ~ .hover-container .link-text {
  opacity: 1;
}
.link:hover ~ .hover-container .image-container {
  opacity: 1;
}

.link-text {
  z-index: 2;
  position: absolute;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 3em;
  color: #fff;
  text-transform: uppercase;
  pointer-events: none;
  -webkit-clip-path: circle(75px at var(--x) var(--y));
          clip-path: circle(75px at var(--x) var(--y));
  opacity: 0;
  -webkit-transition: opacity 250ms ease;
  transition: opacity 250ms ease;
}

.image-container {
  z-index: -2;
  position: absolute;
  top: 0;
  left: 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0