내 체크 박스의 오른쪽 텍스트를 정렬하려고합니다. 현재 텍스트가 여러 줄로 표시됩니다.맞춤 체크 박스 문제 맞춤 CSS
내가 너비를 변경하고 그것을 고정 폭을 제공 시도 :
.checkbox span.custom {
margin-left: 34px;
display: inline-block;
width: 100px; // MY TRY
}
을하지만 옆에있는 텍스트를 체크 박스의 크기를 변경하지 않습니다.
CSS :
* {
box-sizing: border-box;
}
label {
display: inline-block;
}
.checkbox {
position: relative;
min-height: 24px;
font-size: 1.6rem;
}
.checkbox input {
-webkit-tap-highlight-color: transparent;
height: 10px;
margin: 6px;
opacity: 0;
outline: none;
position: absolute;
left: 1px;
top: 1px;
width: 10px;
}
.checkbox .custom {
background-color: #fff;
border: 1px solid #ccc;
border-radius: 3px;
display: inline-block;
height: 24px;
left: 0;
position: absolute;
top: 0;
width: 24px;
}
.checkbox span {
display: inline-block;
margin-left: 34px;
margin-top: 0;
position: relative;
top: 3px;
}
.checkbox input:checked:not(:disabled) + .custom {
background-color: #0574ac;
border-color: #0574ac;
}
.checkbox span {
margin-left: 0px;
}
.checkbox span.custom {
margin-left: 34px;
display: inline-block;
width: 100px; // MY TRY
}
.checkbox span.custom .radio span.custom {
margin-left: 34px;
margin-right: 34px;
display: flex;
}
.radio input:checked + .custom:after {
background-color: #0574ac;
border-radius: 100%;
border: 3px solid #fff;
content: "";
display: block;
height: 16px;
position: absolute;
width: 16px;
}
HTML :
<label for="checkbox1" class="checkbox">
<input id="checkbox1" type="checkbox" role="checkbox" /><span class="custom">Checkbox 1</span>
</label>
음 왜 많은 CSS? 레이블을 체크 박스에 정렬시키고 싶습니까? –
예 레이블을 확인란과 정렬해야합니다. 오른쪽에있는 @AdamBuchananSmith – user4756836
@ user4756836의 체크 상자를 클릭하면 레이블 텍스트와 체크 박스 사이를 전환하고 싶다는 코멘트를 보았습니다. 나는 그 예제를 추가했다. 당신은 대답에서 업데이트를 확인하는 것을 환영한다. – Dekel