پیشنمایش زنده
کد HTML
<div class="radio-inputs">
<label class="radio">
<input checked="" name="auth" type="radio" />
<span class="radio-item">SignIn</span>
</label>
<label class="radio">
<input name="auth" type="radio" />
<span class="radio-item">SignUp</span>
</label>
</div>
کد CSS
.radio-inputs {
position: relative;
display: flex;
flex-wrap: wrap;
border-radius: 4px;
background-color: black;
box-sizing: border-box;
padding: 0.25rem;
width: 340px;
font-size: 14px;
height: 46px;
transition: clip-path 0.3s ease;
}
.radio-inputs .radio {
flex: 1 1 auto;
text-align: center;
}
.radio-inputs .radio input {
display: none;
}
.radio-inputs .radio .radio-item {
display: flex;
cursor: pointer;
align-items: center;
justify-content: center;
border-radius: 4px;
border: none;
padding: 0.5rem 0;
color: #c2c1be;
transition:
background-color 0.5s ease,
font-weight 0.5s ease;
}
.radio-inputs input:checked ~ .radio-item {
background-color: #4d4a45;
font-weight: 600;
color: #fff;
}
.radio-inputs input:checked ~ .radio {
clip-path: polygon(0% 0%, 100% 0%, 90% 100%, 10% 100%);
}