简体   繁体   English

CSS Radio Button Buttons 将标签文本向上包裹并随其移动块

[英]CSS Radio Button Buttons wraps label text upwards and moves the block with it

在此处输入图片说明

I am trying to create a list of buttons from modified radio button.我正在尝试从修改后的单选按钮创建一个按钮列表。 However, as soon as the label becomes 2 liner, the block goes up with the label.但是,一旦标签变成 2 衬里,块就会随标签一起上升。 This is my css code:这是我的 css 代码:

.radio-toolbar input[type="radio"] {
  display:none;
}

.radio-toolbar label {
  display: inline-block;
  padding-top: 10px;
  height: 100px;
  width: 100px;
  border: 1px solid #ccc;
  border-radius: 5px;
  text-align: center;
  background-color: #fff;
  color:#999;

  -webkit-box-shadow: 0px 5px 0px 0px rgba(204,204,204,0.75);
  -moz-box-shadow: 0px 5px 0px 0px rgba(204,204,204,0.75);
  box-shadow: 0px 5px 0px 0px rgba(204,204,204,0.75);
}

.radio-toolbar input[type="radio"]:checked + label {
  height: 100px;
  width: 100px;
  border: 1px solid #00aaa7;
  border-radius: 5px;
  text-align: center;
  background-color: #00aaa7;
  color:#fff;

  -webkit-box-shadow: 0px 5px 0px 0px rgba(0,170,167,1);
  -moz-box-shadow: 0px 5px 0px 0px rgba(0,170,167,1);
  box-shadow: 0px 5px 0px 0px rgba(0,170,167,1);
}


<div class="radio-toolbar margin-top" ng-repeat="physical in physicals">
  <span class="medium-font fw300 dark-gray">{{ physical.name }}</span><br>
  <span ng-repeat="condition in physical.conditions">
    <input ng-click="physicalExam($parent.$index, physical, condition)" type="radio" name="{{ physical.name }}" id="{{ condition._id }}" value="{{ condition.conditionName }}">
    <label class="small-font fw300 gray" for="{{ condition._id }}">{{ condition.conditionName }}</label>
  </span>
</div>

See JFFIDDLE .请参阅JFFIDDLE

.radio-toolbar label { 
  vertical-align: top;
}

Updated fiddle更新的小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM