Changing Text on Link Hover
Similar to the link button using multiple spans inside the link to show display states but this one uses nothing but CSS with :before and :after pseudo-elements.
HTML
<a href="#" id="button">Lapin yliopiston jatkotutkintohaku kevät 2018</a>
CSS
#button {
background-color: white;
border-radius: 7px;
color: #149ECB;
display: block;
font-size: 20px;
height: 30px;
line-height: 50px;
margin: 20px auto;
position: relative;
text-align: center;
text-decoration: none;
width: 500px;
font-family: "open sans";
}
#button:hover {
color: transparent;
}
#button:active {
border: 3px solid red;
color: transparent;
}
#button:before {
color: #00526C;
content: "Lapin yliopiston jatkotutkintohaku kevät 2018";
display: none;
height: 100%;
position: absolute;
text-align: center;
top: 0px;
width: 100%;
}
#button:hover:before {
display: block;
}
#button:hover:after {
display: none;
}
#button:after {
color: red;
content: "active";
display: none;
height: 100%;
position: absolute;
text-align: center;
top: 0px;
width: 100%;
}
#button:active:after {
display: block;
}
#button:active:before {
display: none;
}