加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
load.html 5.00 KB
一键复制 编辑 原始数据 按行查看 历史
王彬 提交于 2024-04-12 13:28 . no message
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Loading Spinner</title>
<style>
.container {
position: relative;
/* 相对定位 */
top: 50%;
/* 上边界移动到容器的50%处 */
transform: translateY(-50%);
/* 向上移动自身高度的50%来达到垂直居中效果 */
text-align: center;
/* 文本水平居中 */
/* line-height: 50px; */
background-color: red;
}
.loader {
position: relative;
/* 相对定位 */
top: 50%;
/* 上边界移动到容器的50%处 */
transform: translateY(-50%);
/* 向上移动自身高度的50%来达到垂直居中效果 */
border: 8px solid #f3f3f3;
/* Light grey background */
border-top: 8px solid #3498db;
/* Blue border */
border-radius: 50%;
/* Circular border */
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
/* Rotate continuously */
margin: 50px auto;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/* 为元素 after before 应用 */
.ad-btn {
line-height: 36px;
padding: 4px 20px;
display: inline-block;
color: #0068FF;
position: relative;
cursor: pointer;
margin-left: 20px;
background-color: red;
}
.ad-btn::after {
content: '';
width: 70%;
position: absolute;
bottom: 0;
right: 15%;
height: 0;
transition: all 0.5s ease;
border: 1px solid #0068FF;
transform: skew(-20deg);
border-radius: 10px;
}
.ad-btn::before {
content: '';
width: 0%;
position: absolute;
bottom: 0;
left: 0%;
height: 0;
transition: all 0.5s ease;
border: none;
transform: skew(-20deg);
border-radius: 10px;
}
.ad-btn:hover::before {
transition: all 0.5s ease;
content: '';
border-top: 1px solid #0068FF;
border-left: 1px solid #0068FF;
height: 100%;
width: 100%;
left: 0;
top: 0;
display: block;
transform: skew(-20deg);
border-radius: 10px;
}
.ad-btn:hover::after {
transition: all 0.5s ease;
content: '';
border-bottom: 1px solid #0068FF;
border-right: 1px solid #0068FF;
border-top: none;
border-left: none;
height: 100%;
width: 100%;
right: 0;
bottom: 0;
display: block;
transform: skew(-20deg);
border-radius: 10px;
}
/* 特殊形状 */
.skewed-box {
position: relative;
width: 200px;
height: 100px;
overflow: hidden;
margin-top: 20px;
}
.skewed-box:before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
background: #3498db;
transform: skew(-20deg);
}
.skewed-box-content {
color: white;
padding: 20px;
position: relative;
z-index: 1;
}
.but {
float: right;
width: 22px;
height: 30px;
margin: 8px 10px;
padding: 0 5px;
display: block;
background: red;
}
.but i {
width: 100%;
height: 2px;
background: yellow;
display: block;
margin-top: 15px;
position: relative;
border-radius: 10px;
transition: 0.4s;
-webkit-transition: 0.4s;
}
.but i:before, .but i:after {
content: "";
position: absolute;
left: 0;
top: 0;
display: block;
width: 100%;
height: 2px;
background: orange;
border-radius: 10px;
transition: 0.4s;
-webkit-transition: 0.4s;
}
</style>
</head>
<body>
<div class="container">
<div class="loader"></div>
</div>
<div class="ad-btn">查看应用场景</div>
<div class="skewed-box">
<div class="skewed-box-content">内容</div>
</div>
<span class="but" id="but2"><i></i></span>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化