0
fontAwesomeを使用してCSS3スタイルのチェックボックスを使用しています。私が実行している小さなフォーマットの問題は、テキストの折り返しがチェックボックスの下に来ることです。ここでは、コードとフィドルは次のとおりです。CSS3スタイルのチェックボックス - チェックボックスの右側にあるラベルテキストをインデント/左揃えしようとしています
CSS:
@import url(//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css);
.wrapper {
width:300px;
}
input[type=checkbox].with-font {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
input[type=checkbox].with-font ~ label:before {
font-family: FontAwesome;
display: inline-block;
content: "\f1db";
letter-spacing: 10px;
font-size: 1.2em;
color: #535353;
width: 1.4em;
}
input[type=checkbox].with-font:checked ~ label:before {
content: "\f00c";
font-size: 1.2em;
color: darkgreen;
letter-spacing: 5px;
}
input[type=checkbox].with-font ~ label:before {
content: "\f096";
}
input[type=checkbox].with-font:checked ~ label:before {
content: "\f046";
color: darkgreen;
}
はHTML:
<div class="wrapper">
<input id="box1" type="checkbox" class="with-font" />
<label for="box1">This is very long text that will wrap underneath the checkbox. Not sure how to flush it properly.</label>
</div>
理想的には私はこのようなテキストを、インデントと正当化したいと思います:
テーブルのラッピングや左浮動divのようないくつかの方法を試しましたが、チェックボックスからラベルを分離しようとするとCSSが壊れるようです。どんな方向にも大変感謝しています!
さて、それは素晴らしいです。どうもありがとうございます! – dangre00