Color changing Hover using HTML | CSS
HTML :
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Hover by Growcode</title>
<link rel="stylesheet" href="Style.css">
</head>
<body>
<div class="container">
<img src="https://www.whatsappimages.in/wp-content/uploads/
2022/03/Free-Best-Joker-WhatsApp-DP-Wallpaper-1.jpg" />
<div class="title">Hi there!</div>
</div>
</body>
</html>
CSS :
@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap");
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
}
.container:hover {
cursor: pointer;
}
.container img {
filter: grayscale();
width: 200px;
height: 200px;
border-radius: 50%;
border: 6px solid whitesmoke;
box-shadow: 2px 2px 10px 2px rgba(0, 0, 0, 0.5);
margin-bottom: 1rem;
transition: filter 0.4s ease-in-out;
}
.container:hover img {
filter: none;
}
.title {
font-family: "Dancing Script", cursive;
font-size: 3rem;
color: whitesmoke;
position: relative;
}
.title::after {
position: absolute;
content: "";
width: 0%;
height: 4px;
background-color: rgb(174, 18, 18);
left: 50%;
bottom: -10px;
transition: all 0.4s ease-in-out;
}
.container:hover .title::after {
width: 100%;
left: 0;
}
body {
background: darkslateblue;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
Comments
Post a Comment