HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hover button</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button>Creation code</button>
</body>
</html>
CSS:
body{
margin: 0;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: navy;
}
p{
font-size: 3rem;
font-family: Verdana, Geneva, Tahoma, sans-serif;
position: relative;
right: 50px;
}
button{
position: relative;
border: none;
outline: none;
width: 170px;
height: 55px;
background-color: red;
font-size: 1.4rem;
color: #fff;
border-radius: 7px;
cursor: pointer;
font-family: 'Times New Roman', Times, serif;
}
buttona::before{
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color:red;
z-index: -1;
border-radius: 7px;
transform: translateY(5px);
}
button:active{
transform: translateY(5px);
}
button:active:before{
transform: translateY(0);
}
Comments
Post a Comment