I wrote a HTML page with CSS that changes color of the text to red when the user puts their mouse over it and returns to white if the mouse is moved out.
The problem is that the text does a "fade in" animation when the page is loaded because of the transition: 2s color linear;
(that I need to change the color to red from white, but at the start it changes from transparent(I think) to white)
Is there a way to make the text show up instantly without the fade-in?
Here's the code and the jsfiddle, but you need to copy and paste the code on your computer and open it with a browser to see the "fade in" (on jsfiddle it appears without the unwanted effect)
Here's the HTML
html,
body {
background-color: black;
color: white;
overflow: hidden;
}
p {
text-align: center;
cursor: default;
}
.watermark {
display: block;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
resize: none;
}
#watermark {
color: white;
font-size: 260%;
transition: 2s color linear;
-webkit-transition: color 2s linear;
}
#watermark:hover {
transition: 0.5s ease-in-out;
-webkit-transition: 0.5s linear;
color: rgb(255, 17, 69);
}
<!DOCTYPE html>
<html lang="it">
<head>
<link rel="stylesheet" type="text/css" href="home.css">
</head>
<body>
<div class="watermark">
<p id="watermark">hover effect</p>
</div>
</body>
</html>
=