본문 바로가기
퍼블리싱

CSS 활용 - 라디오 버튼 커스텀 스타일

by lionbum 2022. 3. 23.

 

 

라디오 버튼 스타일 변경 하기 

브라우저 별로 다르게 보이는 라디오 버튼 디자인 -

리셋하고 다시 스타일 주기! 

 

 

 

 

HTML

<div class="checks">
    <input type="radio" id="ex_rd" name="ex_rds">
    <label for="ex_rd">커스텀스타일1 </label>
    <input type="radio" id="ex_rd2" name="ex_rds">
    <label for="ex_rd2">커스텀스타일2</label>
</div>

 

 

CSS 

 
.checks {
    position: relative;
    height: 20px;
    padding: 30px;
    line-height: 20px;
}
.checks label {
    font-size: 16px;
    color: #666;
    margin-right: 10px;
    vertical-align: middle;
}
            
.checks input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.checks input[type="radio"]+label {
    display: inline-block;
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
            
.checks input[type="radio"]+label:before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0px;
    width: 14px;
    height: 14px;
    text-align: center;
    background: #fff;
    border: 1px solid #cacece;
    border-radius: 100%;
    box-shadow: none;
}
.checks input[type="radio"]:checked+label:before {
    background: #fff;
    border-color: #e86138;
} 
            
.checks input[type="radio"]:checked+label:after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 14px;
    height: 14px;
    background: #e86138;
    border-radius: 100%;
    box-shadow: none;
}
728x90
반응형

댓글