I'm trying to get the "Book an Appointment" button to work on this website https://templates.hibootstrap.com/arrola/default/index-2.html. I have the following css
.appointmentButton:before {
content: '';
position: absolute;
top: 0;
width: 100%;
height: 100%;
transform: scale(0);
left: 0;
right: 0;
opacity: 0;
z-index: -1;
transition: all 0.5s;
}
.appointmentButton {
padding: 10px 30px;
color: white;
text-align: center;
position: relative;
overflow: hidden;
z-index: 0;
text-transform: capitalize;
transition: 0.5s;
background-color: $black1;
border: none;
outline: none;
text-decoration: none;
&:hover:before {
background-color: $greenColor;
transform: scale(1);
opacity: 1;
}
}
and the html element:
<a className={styles.appointmentButton} href="/appointment">Book an Apppointment</a>
.
I'm trying to get the button background colour to change to green.
CodePudding user response:
appointmentButton add display: inline block
.appointmentButton {
padding: 10px 30px;
color: white;
text-align: center;
position: relative;
z-index: 1;
overflow: hidden;
text-transform: capitalize;
transition: 0.5s;
border: none;
outline: none;
text-decoration: none;
background-color: #191f30;
display: inline-block;
}
.appointmentButton::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
transform: scale(0);
opacity: 0;
transition: all 0.5s;
background-color: #72ae44;
z-index: -1;
}
.appointmentButton:hover::before {
width: 100%;
height: 100%;
transform: scale(1);
opacity: 1;
}
<a href="/appointment">Book an Apppointment</a>