无线电为真时改变行为(不改变HTML结构)

时间:2016-09-26 19:33:05

标签: css3 sass

朋友我需要在收音机真实时应用样式(span class =“ui-radiobutton-icon”),可以帮助我。 荷。

限制:HTML结构

<div class="ui-radiobutton ui-widget">
   <div class="ui-helper-hidden-accessible">
       <input type="radio" name="groupname" value="Masculino" ng-reflect-checked="true">
   </div>
   <div ng-reflect-ng-class="[object Object]" class="ui-radiobutton-box ui-widget ui-state-default ui-state-active">
       <span class="ui-radiobutton-icon fa fa-fw fa-circle" ng-reflect-klass="ui-radiobutton-icon" ng-reflect-ng-class="[object Object]"></span>
   </div>
</div>

1 个答案:

答案 0 :(得分:1)

以下是使用您的结构的示例,但收音机已移至ui-radiobutton

这对你有用吗?

input {
  display: none;
}
label {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid black;
}
input:checked ~ .ui-helper-hidden-accessible label {
  background: gray;
}
input:checked ~ .ui-radiobutton-box .ui-radiobutton-icon {
  color: red;
}
<div class="ui-radiobutton">
  <input id="ui-radio-hidden" type="radio" name="uir">
  <div class="ui-helper-hidden-accessible">
    <label for="ui-radio-hidden"></label>
  </div>
  <div class="ui-radiobutton-box">
    <span class="ui-radiobutton-icon fa fa-fw fa-circle">Red when checked</span>
  </div>
</div>