
CSS Glowing Text Hover Effects | Quick HTML CSS Tutorial For Beginner
Creating glowing text hover effects using HTML and CSS is a popular way to add interactivity to your website. Below is a simple example of how you can achieve this effect:
html code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glowing Text Hover Effect</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
.glow-text {
font-size: 36px;
font-family: 'Arial', sans-serif;
color: #333;
position: relative;
display: inline-block;
text-align: center;
transition: color 0.3s ease-in-out;
}
.glow-text::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
z-index: -1;
color: #00bcd4; /* Set the glow color */
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
.glow-text:hover {
color: #00bcd4; /* Change the text color on hover */
}
.glow-text:hover::before {
opacity: 1;
}
</style>
</head>
<body>
<div class="glow-text" data-text="Glowing Text">Glowing Text</div>
</body>
</html>
In this example, we have a div element with the class glow-text. The glow effect is achieved by using the ::before pseudo-element to create a duplicate of the text, which is positioned behind the original text. The opacity property is used to control the visibility of the glowing text, and the transition property is used to create a smooth transition effect.
Feel free to customize the font size, font family, colors, and other properties to match your design preferences.
0 Comments