html - CSS: '+' selection operator not working -
the background color of span not change after radio button changed should.
why happening? how fix it?
div { margin: 0 0 0.75em 0; } .formgroup input[type="radio"] { display: none; } input[type="radio"], label { color: brown; font-family: arial, sans-serif; font-size: 14px; } input[type="radio"], label span { display: inline-block; width: 19px; height: 19px; margin: -1px 4px 0 0; vertical-align: middle; cursor: pointer; -moz-border-radius: 50%; border-radius: 50%; } input[type="radio"], label span { background-color: brown; } input[type="radio"]:checked + p + span{ background-color:orange; } input[type="radio"] + span, input[type="radio"]:checked + span { -webkit-transition:background-color 0.4s linear; -o-transition:background-color 0.4s linear; -moz-transition:background-color 0.4s linear; transition:background-color 0.4s linear; }
<div class="main"> <section class="artistpage"> <div class="search"> <h1>artist directory</h1> </div> <ul class="artistlist"> <li class="artist cf"> <div class="info"> <label class="formgroup"> <input type="radio"> <span></span>op1 <span></span>op2 <span></span>op3 </label> </div> </li> </ul> </div>
whichever radio option choose, first 1 gets selected.
your radio button group isn't way supposed be. suggest alter that.
<ul class="artistlist"> <li class="artist cf"> <div class="info"> <label class="formgroup"> <input type="radio" name = "op"><span></span>op1 <input type="radio" name = "op"><span></span>op2 <input type="radio" name = "op"><span></span>op3 </label> </div> </li> </ul>
Comments
Post a Comment