How to align checkboxes and their labels consistently cross-browsers

前端 未结 30 1856
有刺的猬
有刺的猬 2020-11-22 05:56

This is one of the minor CSS problems that plagues me constantly. How do folks around Stack Overflow vertically align checkboxes and

30条回答
  •  -上瘾入骨i
    2020-11-22 06:23

    This works well for me:

    fieldset {
      text-align:left;
      border:none
    }
    fieldset ol, fieldset ul {
      padding:0;
      list-style:none
    }
    fieldset li {
      padding-bottom:1.5em;
      float:none;
      clear:left
    }
    label {
      float:left;
      width:7em;
      margin-right:1em
    }
    fieldset.checkboxes li {
      clear:both;
      padding:.75em
    }
    fieldset.checkboxes label {
      margin:0 0 0 1em;
      width:20em
    }
    fieldset.checkboxes input {
      float:left
    }

提交回复
热议问题