<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Dia 20</title>
</head>
<body>
<a href="#">Desafio de CSS</a>
</body>
</html>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
body
{
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #222;
}
a
{
text-decoration: none;
color: white;
font-family: sans-serif;
font-size: 40px;
border: 3px solid white;
padding: 30px 70px;
transition: all 0.3s;
position: relative;
overflow: hidden;
}
a:hover
{
background-color: #000000;
}
a:before
{
content: '';
background-color: white;
top: 0;
left: 0;
width: 100%;
height: 50px;
position: absolute;
transform: translateX(-100%) rotate(45deg);
transition: all 0.3s;
}
a:hover:before
{
transform: translateX(100%) rotate(45deg);
}
JS
格式化