I have 2 buttons
and a container
surrounding them. made that container have a display of flex
and centered the two buttons in the middle of the div
. when I hover over one of them. the other changes slightly as well. How can I avoid this? I know that the issue is from display: flex;
because it does what I want when I remove it. But I need to keep the elements centered,
.two-buttons-container {
width: 30%;
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
}
.button {
font-size: 100%;
background-color: rgb(242, 242, 242);
border: none;
border-radius: 2px;
height: 100%;
padding: 2vh;
}
.search-button {
margin-right: 20px;
white-space: nowrap;
font-size: 100%;
}
.lucky-button {
margin-left: 20px;
white-space: nowrap;
}
.search-button:hover {
border: 1.5px solid lightgray;
cursor: pointer;
}
.lucky-button:hover {
border: 1.5px solid lightgray;
cursor: pointer;
}
<div class="two-buttons-container">
<button type="submit" class="button search-button">Google Search</button>
<form action="https://www.google.com/doodles"><button type="submit" class="button lucky-button">I'm feeling lucky</button></form>
</div>