-1

チェックボックス専用のラベルをcssで選択できる方法はありますか?

私はこのcssコードを使用しています input[type="radio"], input[type="checkbox"] { position: absolute; 左: -999em; }

label:before 
{ 
    display: inline-block; position: relative; top:0.25em; left:-2px; 
    content:''; width:25px; height:25px;
    background-image:url(formelements.png); 
}

input[type="checkbox"] + label:before 
{ 
    background-position: 0 -25px;
}         
input[type="checkbox"]:checked + label:before 
{
    background-position: 0 0 ; 
}
input[type="radio"] + label:before 
{ 
    background-position: -25px -25px;
} 
input[type="radio"]:checked + label:before 
{
    background-position: -25px 0;
}

画像が必要な場合は、ここから取得できます。また、スタイリングのためにフォローしているガイドもここにあります が、私が直面している問題は、すべての入力のすべてのラベルが影響を受けることです。チェックボックス用のラベルのみをスタイルする方法はありますか?

よろしくお願いします

4

1 に答える 1

0

チェックボックス ラベルのカスタム CSS。私の場合は動作します:

.medview input[type="checkbox"][class="selectorThumbs"] + label:before {
    background: url('../icons/thumbs.png') no-repeat;
}
.medview input[type="checkbox"][class="selectorThumbs"]:checked + label:before {
    background: url('../icons/thumbs1.png') no-repeat;
}
于 2013-04-29T07:41:12.543 に答える