I am having a bit of difficulty adding an arrow icon within a button. i have been trying different functions and codes but haven’t really gotten anywhere. I am trying to add an arrow animation that indicates to the users that this is a shortcut to the desired page.
if anyone knows how to go about this, i would really appreciate the help.
<a href="#">
<button class="submit" title="Book Now">Book Now <i class="fas fa-angle-right"></i></button>
</a>
#booking button.submit {
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
background-color: lightblue; /* sets the background color of the button */
color: black; /* sets the text color of the button */
border: none; /* removes border from the button */
border-radius: 5px;
padding: 10px 20px; /* adds padding to the button */
font-size: 20px; /* sets the font size of the button */
cursor: pointer; /* changes cursor on hover to indicate button is clickable */
margin-bottom: 5px;
margin-left: 30px;
}
#booking button.submit:hover {
color: grey;
}
2
Answers
You can get this animation by using this
CSS:
HTML
Source Code:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_buttons_animate1
so you want to make it so that when you hover over the button, the arrow rotates in the other direction? In other words, when hovered, it should look like it has the fa-angle-left class?
You can do this by several ways:
Just add this style:
.submit:hover .fa-angle-right {
transform: rotate(180deg);
}
You can create 2 ‘i’ and hide/display these elements, when necessary
html:
css: