**[チェックボックス] [ラベル] の並びだと以下のCSS、htmlで対応できました。
同じ動きを[ラベル] [チェックボックス] だとどういう方法になるでしょうか。
おそらく、:checkedの時のlabelの指定方法さえわかれば解決すると思うのですが。。。
jQueryという方法を取らずに解決したいです。**
.demo01 input[type="checkbox"] {
display: none;
}
.demo01 input[type="checkbox"] + label {
display: block;
cursor: pointer;
margin: 5px;
}
.demo01 input[type="checkbox"] + label::before {
width: 16px;
height: 16px;
line-height: 15px;
font-size: 12px;
display: inline-block;
vertical-align: middle;
text-align: center;
content: "\2713";
color: transparent;
padding: 0;
border-radius: 1px;
border: 2px solid #C8C9CA ;
background: #fff;
margin: -2px 10px 0 0;
-webkit-transition: .1s;
transition: .1s;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.demo01 input[type="checkbox"]:checked + label::before {
font-size: 20px;
background: #fff !important;
border-color: #C8C9CA !important;
color: #E95513 !important;
line-height: 5px;
}
<div class="demo01"> <input type="checkbox" id="demo001"><label for="demo001">hogehoge</label> </div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/31 04:42 編集
2015/07/31 04:49