As a beginner in CSS, I decided to practice padding and margin mechanics by creating two buttons. Now, I'm trying to make the buttons larger without one button pushing the other out of place. I managed to achieve this for the save button, but I'm struggling with the other one.
.apply-button {
margin-left: 20px;
margin-right: 20px;
background-color: rgb(10, 102, 194);
color: white;
border: none;
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 120px;
font-weight: bold;
font-size: 17px;
margin-top: none;
cursor: pointer;
transition: background-color 0.15s, color 0.15s, margin-left 0.15s, margin-right 0.15s, padding-left 0.15s, padding-right 0.15s, font-size 0.15s;
}
.apply-button:hover {
margin-left: 13px;
margin-right: 13px;
padding-left: 22px;
padding-right: 22px;
padding-top: 11px;
padding-bottom: 11px;
font-size: 18px;
background-color: rgb(0, 59, 122);
color: rgba(255, 255, 255, 0.801);
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.26);
}
.save-button {
margin-left: 18px;
margin-top: 50px;
background-color: rgb(255, 255, 255);
color: rgb(10, 102, 194);
border-color: rgb(10, 102, 194);
padding-left: 20px;
padding-right: 20px;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 40px;
border-width: 2px;
border-style: solid;
font-weight: bold;
font-size: 17px;
cursor: pointer;
transition: box-shadow 0.15s, margin-left 0.15s, padding-right 0.15s, padding-left 0.15s;
}
.save-button:hover {
margin-left: 10px;
background-color: rgba(87, 171, 255, 0.26);
padding-left: 24px;
padding-right: 24px;
border-width: 3px box-shadow:0px 3px 10px rgba(0, 0, 0, 0.26);
}
.save-button:active {
background-color: rgb(10, 102, 194);
color: white;
}
<button class="apply-button">
Apply on company website
</button>
<button class="save-button">
Save
</button>
Although I attempted to adjust the margins while increasing the padding upon hovering, the larger button is still pushing the other one as it expands. Being new to this, I acknowledge that there may be alternative methods to solve this issue. Thank you.reference video