复选框未正确以反应形式出现

发布于 2025-02-10 23:08:41 字数 3271 浏览 2 评论 0原文

我的页面上有以下复选框。

我正在使用以下CSS。我在这个组合中做了很多变化,但没有任何作用。我该如何使它们正确。我的意思是复选框标签应该适当吗?

     .form__container {
      display: flex;
      flex-wrap: wrap;
    }
        .form__container checkbox-label{
          size: 100%;
          position: relative;
          flex-wrap: wrap;
          width: 280px;
        
        }

overall css of this page is below.

input[type="date"]:before {
  content: attr(placeholder);
  color: #aaa;
  margin-right: 0.5em;
}

input[type="date"] {
  width: 200px;
}



.validation-error {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  margin: 0;
  z-index: 99999999;

  .checkbox-label {
    width: auto;
  }

  .dismiss-modal-button {
    margin-top: 10px;
  }
}

.input {
  padding: 7px;
}

.invalid {
  border: solid #e2a4a4 1px;
}

label#inputError {
  border: none;
  box-shadow: none;
  color: #da3131;
}

span.glyphicon.glyphicon-remove.form-control-feedback {
  color: #7b6363;
}

.fade {
  opacity: 1;
}

.form__container {
  display: flex;
  flex-wrap: wrap;
}

.form__container input {
  size: 100%;
  //position: relative;
  flex-wrap: wrap;
  width: 280px;

}

.checkbox-label  {
  width: auto;

}

li{
  width: 50px;
}

.react-form-builder-form {
  position: relative;

  .rfb-item.alwaysbreak {
    page-break-before: always;
  }

  .rfb-item.nobreak:before {
    clear: both;
  }

  .rfb-item.nobreak {
    page-break-inside: avoid;
  }

  .rfb-item {
    padding: 10px 0 0;
    position: relative;

    label {
      font-weight: normal;
    }

    .bold {
      font-weight: bold;
    }

    .italic {
      font-style: italic;
    }

    .form-label {
      display: block !important;
    }

    .form-group {
      .option-inline {
        display: inline-block !important;
        margin-right: 10px;
      }

      a {
        cursor: pointer;
      }

      input[type='date'] {
        height: 42px;
      }

      .m-signature-pad {
        position: relative;
        width: auto;
      }

      .react-star-rating {
        display: block;
      }

      .checkbox-label,
      .radio-label {
        font-weight: normal;
        display: block;
      }

      .label-required {
        margin-left: 5px;
      }
    }
  }
}

我的动态形式可以从后端传递。

 <div>
        <FormValidator emitter={this.emitter} />
        <div >
          <form encType='multipart/form-data' action={this.props.form_action} method={this.props.form_method} className='form__container'>
            { this.props.authenticity_token &&
              <div style={formTokenStyle}>
                <input name='utf8' type='hidden' value='&#x2713;' />
                <input name='authenticity_token' type='hidden' value={this.props.authenticity_token} />
                <input name='task_id' type='hidden' value={this.props.task_id} />
              </div>
            }
            {items}
          </form>
          <div>
            {validationList}
          </div>
        </div>
      </div>

I have below checkboxes on my page.

enter image description here

I am using below css for it. I did lot of changes in this combinatioon but nothing is working. how can I make them proper. I mean checkbox and label should come proper?

     .form__container {
      display: flex;
      flex-wrap: wrap;
    }
        .form__container checkbox-label{
          size: 100%;
          position: relative;
          flex-wrap: wrap;
          width: 280px;
        
        }

overall css of this page is below.

input[type="date"]:before {
  content: attr(placeholder);
  color: #aaa;
  margin-right: 0.5em;
}

input[type="date"] {
  width: 200px;
}



.validation-error {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  margin: 0;
  z-index: 99999999;

  .checkbox-label {
    width: auto;
  }

  .dismiss-modal-button {
    margin-top: 10px;
  }
}

.input {
  padding: 7px;
}

.invalid {
  border: solid #e2a4a4 1px;
}

label#inputError {
  border: none;
  box-shadow: none;
  color: #da3131;
}

span.glyphicon.glyphicon-remove.form-control-feedback {
  color: #7b6363;
}

.fade {
  opacity: 1;
}

.form__container {
  display: flex;
  flex-wrap: wrap;
}

.form__container input {
  size: 100%;
  //position: relative;
  flex-wrap: wrap;
  width: 280px;

}

.checkbox-label  {
  width: auto;

}

li{
  width: 50px;
}

.react-form-builder-form {
  position: relative;

  .rfb-item.alwaysbreak {
    page-break-before: always;
  }

  .rfb-item.nobreak:before {
    clear: both;
  }

  .rfb-item.nobreak {
    page-break-inside: avoid;
  }

  .rfb-item {
    padding: 10px 0 0;
    position: relative;

    label {
      font-weight: normal;
    }

    .bold {
      font-weight: bold;
    }

    .italic {
      font-style: italic;
    }

    .form-label {
      display: block !important;
    }

    .form-group {
      .option-inline {
        display: inline-block !important;
        margin-right: 10px;
      }

      a {
        cursor: pointer;
      }

      input[type='date'] {
        height: 42px;
      }

      .m-signature-pad {
        position: relative;
        width: auto;
      }

      .react-star-rating {
        display: block;
      }

      .checkbox-label,
      .radio-label {
        font-weight: normal;
        display: block;
      }

      .label-required {
        margin-left: 5px;
      }
    }
  }
}

I have dynamic form which gets delivered from backend.

 <div>
        <FormValidator emitter={this.emitter} />
        <div >
          <form encType='multipart/form-data' action={this.props.form_action} method={this.props.form_method} className='form__container'>
            { this.props.authenticity_token &&
              <div style={formTokenStyle}>
                <input name='utf8' type='hidden' value='✓' />
                <input name='authenticity_token' type='hidden' value={this.props.authenticity_token} />
                <input name='task_id' type='hidden' value={this.props.task_id} />
              </div>
            }
            {items}
          </form>
          <div>
            {validationList}
          </div>
        </div>
      </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

成熟稳重的好男人 2025-02-17 23:08:41

@mahima尝试更改显示:块 to inline-block。

 .checkbox-label,
       .radio-label {
         font-weight: normal;
         display: inline-block;
       }

这在工作!

@Mahima Try changing display: block to inline-block.

 .checkbox-label,
       .radio-label {
         font-weight: normal;
         display: inline-block;
       }

This is working!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文