更新第28个小实例

This commit is contained in:
DESKTOP-BM6RJU5\wyanh 2021-10-30 22:00:29 +08:00
parent afe2e549f5
commit a48189c686
3 changed files with 117 additions and 1 deletions

View File

@ -31,4 +31,5 @@
24. HTML5+CSS3小实例之酷炫的ANIPLEX文字特效
25. HTML5+CSS3小实例之后台管理系统的侧边导航栏
26. HTML5+CSS3小实例之自定义滤镜实现液体加载动画
27. HTML5+CSS3小实例之3D旋转木马相册
27. HTML5+CSS3小实例之3D旋转木马相册
28. HTML5+CSS3小实例之云朵特效按钮

80
css/28.css Normal file
View File

@ -0,0 +1,80 @@
*{
/* 初始化 取消页面元素的内外边距 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 弹性布局 水平、垂直居中 */
display: flex;
justify-content: center;
align-items: center;
/* 渐变背景 */
background: linear-gradient(200deg,#00c6fb,#66a6ff);
}
nav ul{
list-style: none;
margin: 0;
padding: 0;
}
nav ul li{
/* 自定义属性--c */
--c:#fff;
/* 通过var函数调用自定义属性--c */
color: var(--c);
width: 240px;
height: 60px;
border: 3px solid var(--c);
border-radius: 10px;
text-align: center;
line-height: 60px;
font-weight: bold;
cursor: pointer;
margin: 30px;
/* 相对定位 */
position: relative;
/* 这里加个溢出隐藏 */
overflow: hidden;
z-index: 1;
/* 最后在加个动画过渡 */
transition: 0.5s;
}
nav ul li:hover{
/* 鼠标移上改变按钮字体颜色 */
color: #222;
}
nav ul li span{
/* 绝对定位 */
position: absolute;
width: 25%;
height: 100%;
background-color: var(--c);
border-radius: 50%;
/* 先沿Y轴下移,移出按钮范围 */
transform: translateY(150%);
/* 通过var函数调用自定义属性--n,结合calc函数计算得出left的值 */
left: calc((var(--n) - 1) * 25%);
/* 加个动画过渡 */
transition: 0.5s;
/* 设置每一个span元素的动画延迟时间 */
transition-delay: calc((var(--n) - 1) * 0.1s);
z-index: -1;
}
nav ul li:hover span{
/* 沿Y轴上移并放大 */
transform: translateY(0) scale(2);
}
nav ul li span:nth-child(1){
/* 自定义属性 */
--n:1;
}
nav ul li span:nth-child(2){
--n:2;
}
nav ul li span:nth-child(3){
--n:3;
}
nav ul li span:nth-child(4){
--n:4;
}

35
html/28.html Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>云朵特效按钮</title>
<link rel="stylesheet" href="../css/28.css">
</head>
<body>
<nav>
<ul>
<li>
点赞
<span></span><span></span><span></span><span></span>
</li>
<li>
关注
<span></span><span></span><span></span><span></span>
</li>
<li>
评论
<span></span><span></span><span></span><span></span>
</li>
<li>
转发
<span></span><span></span><span></span><span></span>
</li>
</ul>
</nav>
</body>
</html>