我正在處理樣式CSS複選框。事情看起來不錯,但我有一個問題。如果箱子標籤上有很多文字,則這些箱子最終不一致。CSS複選框樣式
我該如何更改我的代碼,使複選框位於文本的左側,以保持一致?
這裏是一個的jsfiddle:https://jsfiddle.net/7295tvp0/
span.bigcheck-target {
font-family: FontAwesome;
font-size: 1.2em;
margin-top: 20px!important;
}
input[type='checkbox'].bigcheck {
position: relative;
left: -999em;
font-size: 2em;
}
input[type='checkbox'].bigcheck + span.bigcheck-target:after {
content: "\f096";
}
input[type='checkbox'].bigcheck:checked + span.bigcheck-target:after {
content: "\f046";
}
span.bigcheck {
display: block;
font-size: 20px;
}
.bigcheck-target {
position: relative
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<span class="bigcheck">
<label class="bigcheck">Short
<input name="amenities" value="wifi" type="checkbox" class="bigcheck" name="cheese" value="yes"/>
<span class="bigcheck-target"></span>
</label>
</span>
<span class="bigcheck">
<label class="bigcheck">Much longer name
<input name="amenities" value="personal_video" type="checkbox" class="bigcheck" name="cheese" value="yes"/>
<span class="bigcheck-target"></span>
</label>
</span>