【问题标题】:Using one label for two input box,Input boxes not lining up correctly两个输入框使用一个标签,输入框排列不正确
【发布时间】:2019-01-12 10:58:06
【问题描述】:

我想在 wordpress 中从 7 开始设计这样的图片。我已经尝试过,但无法理解我的错误。

我的代码:

<div class="row" style="margin:0;">
<div class="col-sm-6" style="padding:0;">

  <div class="col-sm-6">
    <div class="form-group">
<label for="name">Name:</label><span style="color:red;" class:col-sm-1>*</span>
      [text* your-name id:Name class:very-special-field-for-checkbox class:form-control placeholder "First Name"]
    </div>
  </div><!-- /.col -->
  <div class="col-sm-6">
    <div class="form-group">
<label ></label>
     [text* your-name id:Name class:form-control placeholder "Last Name"]
    </div>
  </div>
</div>
  </div>

【问题讨论】:

    标签: html css wordpress twitter-bootstrap bootstrap-4


    【解决方案1】:

    看到这个小提琴, Bootstrap-4 行使用 flexbox 并且“flex-wrap”属性默认设置为“wrap”。 你让它“nowrap”。 https://jsfiddle.net/f2tkexrL/21/

    .row {
      flex-wrap: nowrap;
    }
    
    .form-group {
      margin: 0;
    }
    <div class="row" style="margin:0;">
      <div class="col-sm-6" style="padding:0;">
        <div class="col-sm-6">
          <div class="form-group">
            <label for="name">Name:</label><span style="color:red;" class:col-sm-1>*</span>
          </div>
        </div>
        <!-- /.col -->
        <div class="col-sm-6">
          <div class="row">
            <div class="col-sm-3 form-group">
              <input type="text">
              <label>First Name</label>
            </div>
            <div class="col-sm-3 form-group">
              <input type="text">
              <label>Last Name</label>
            </div>
          </div>
        </div>
      </div>
    </div>

    【讨论】:

    • 感谢您的回答。如何在 * 顶部添加验证测试?提交表单后会看到文本。如何执行此操作?我试过了,但此验证文本似乎在文本框下。
    • 如果需要名称,则需要在两个输入字段中使用“required”属性。像这样,
    猜你喜欢
    • 2015-08-18
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 2012-09-03
    • 2019-02-03
    • 1970-01-01
    相关资源
    最近更新 更多