【问题标题】:CSS - Label & checkbox not aligning same as other labels and checkboxCSS - 标签和复选框与其他标签和复选框不对齐
【发布时间】:2019-01-27 18:10:21
【问题描述】:

我正在进行一项小型调查,我的“复选框标签”和复选框不会与其他标签对齐。 所有标签都具有相同的类别。我需要它与其他人一样对齐。

这是我的 codepen 的链接,向您展示我的意思:

https://codepen.io/Saharalara/pen/xMGqPa

.labels {
  display: inline-block;
  text-align: right;
  vertical-align: top;
  margin-top: 20px;
  width: 40%;
  padding: 5px;
}

.rightTab {
  display: inline-block;
  text-align: left;
  margin-top: 20px;
  vertical-align: middle;
  width: 48%;
  padding: 5px;
}

.radio,
.checkbox {
  position: relative;
  left: -44px;
  display: block;
  padding-bottom: 10px;
}
<div class="rowTab">
  <div class="labels">
    <label id="checkbox-label" for="changes">What do you think we should do to improve our fabulous toilet if any...</br>there should'nt be any but choose please:</label>
  </div>
  <div class "rightTab">
    <ul id="changes">
      <li class="checkbox"><label><input name="prefer" value="1" type="checkbox" class="userRatings">Cleanliness</label></li>
      <li class="checkbox"><label><input  name="prefer" value="2" type="checkbox" class="userRatings">Friendliness</label></li>
      <li class="checkbox"><label><input  name="prefer" value="3" type="checkbox" class="userRatings">Everything, it's shite</label></li>
      <li class="checkbox"><label><input  name="prefer" value="4" type="checkbox" class="userRatings">Nothing, it's fantastic</label></li>
      <li class="checkbox"><label><input  name="prefer" value="5" type="checkbox" class="userRatings">No changes required, it's is the best toilet I've ever been to</label></li>
    </ul>
  </div>
</div>

【问题讨论】:

    标签: html css checkbox label alignment


    【解决方案1】:

    您错过了=。而且,在这种情况下,这非常重要。改变

    <div class "rightTab">
    

    ...到:

    <div class="rightTab">
    

    working here

    【讨论】:

    • 我不敢相信就是这样。非常感谢。我花了很长时间一遍又一遍地阅读这段代码。再次感谢!!
    • 这很简单。在php 文件的末尾检测到一个空格字符,创建一个白屏死机。这曾经是的挑战:)。度过一个愉快的夜晚。
    猜你喜欢
    • 2012-10-24
    • 2014-08-29
    • 2014-01-22
    • 2012-03-11
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 2017-07-27
    • 1970-01-01
    相关资源
    最近更新 更多