I used the following code snippet to get the effect on the Submit buttons in the form.
HTML:
a.bttn-dark:hover {
color: #FFF;
}
a.bttn-dark:focus {
color: #FFF;
}
.bttn:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
position: absolute;
top: 0;
left: 50%;
right: 50%;
bottom: 0;
opacity: 0;
content: '';
background-color: #FF0072;
z-index: -2;
}
.bttn:hover:before {
-webkit-transition: 0.5s all ease;
transition: 0.5s all ease;
left: 0;
right: 0;
opacity: 1;
}
<div class="flex">
<a href="#0" class="bttn">Continue</a>
</div>
<div class="flex dark">
<a href="#0" class="bttn-dark">Continue</a>
</div>
I am confused about the usage of following,
what would be different if a:hover is only used instead of a.bttm-dark:hover ?
bttn:before and bttn:hover:before
- why is the pseudo element bttn:hover appearing in the HTML document after bttn element? Shouldn't it come before?