Настройте выравнивание на flex-start
, чтобы избежать растяжения тега a
:
.wrapper {
flex-direction: column;
box-sizing: border-box;
display: flex;
max-width: 50%;
text-align: center;
}
.flex-box {
flex-direction: row;
box-sizing: border-box;
display: flex;
align-items:flex-start; /*Added this*/
}
button {
margin-right: 16px;
flex: 1 1 100%;
box-sizing: border-box;
max-width: 50%;
margin-bottom: 50px;
}
a {
flex: 1 1 100%;
box-sizing: border-box;
max-width: 50%;
}
a:hover {
color: red;
}
<div class="wrapper">
<div class="flex-box">
<button type="button">Login</button>
<a href="#">Forget Password</a>
</div>
</div>
Вы также можете добавить margin-bottom:auto
к a
.wrapper {
flex-direction: column;
box-sizing: border-box;
display: flex;
max-width: 50%;
text-align: center;
}
.flex-box {
flex-direction: row;
box-sizing: border-box;
display: flex;
}
button {
margin-right: 16px;
flex: 1 1 100%;
box-sizing: border-box;
max-width: 50%;
margin-bottom: 50px;
}
a {
flex: 1 1 100%;
box-sizing: border-box;
max-width: 50%;
margin-bottom:auto; /*Added this*/
}
a:hover {
color: red;
}
<div class="wrapper">
<div class="flex-box">
<button type="button">Login</button>
<a href="#">Forget Password</a>
</div>
</div>