I'm currently learning CSS and I am trying to create an effect where, on hover over some text, the text disappears and an image fades in. I have been experimenting with different methods but haven't quite achieved the desired outcome.
The text is within a link element and on hover, I want to set a background image. While I could use a span within the anchor tag, I prefer the text to be centered within the div, which already has an absolute position.
Below is the HTML code:
<div class="header">
<!--<ul>-->
<div class="header_element">
<a title="Home" href="page.php"> Home </a>
</div>
And this is the corresponding CSS:
div.header_element {
display: table-cell;
text-align: center;
vertical-align: middle;
height: 100%;
}
div.header_element:hover {
background-position: center;
background-image: url("hover.png");
background-repeat: no-repeat;
}
If anyone has any suggestions or solutions, I would greatly appreciate your help. Thank you!