<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Efeito hover</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<button class="btn">Desafio 30 dias CSS</button>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
*
{
margin: 0;
padding: 0;
font-family: "montserrat", sans-serif;
}
body
{
background: #353b48;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.btn
{
width: 200px;
height: 60px;
background: none;
border: 4px solid;
color: pink;
font-weight: 700;
text-transform: uppercase;
cursor: pointer;
font-size: 16px;
position: relative;
}
.btn::before, .btn::after
{
content: "";
position: absolute;
width: 14px;
height: 4px;
background: #353b48;
transform: skewX(50deg);
transition: .4s linear;
}
.btn::before
{
top: -4px;
left: 10%;
}
.btn::after
{
bottom: -4px;
right: 10%;
}
.btn:hover::before
{
left: 80%;
}
.btn:hover::after
{
right: 80%;
}
JS
格式化