html - 两个输入框使用一个标签,输入框没有正确排列

标签 html css wordpress twitter-bootstrap bootstrap-4

我想在 wordpress 的 7 contact 中设计这样的图像。我试过了,但无法理解我的错误。

enter image description here

我的代码:

<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>

最佳答案

看到这个 fiddle , 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>

关于html - 两个输入框使用一个标签,输入框没有正确排列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51691427/

相关文章:

java - 使用 <html :text instead of &lt;input type ="text" in struts? 的目的是什么

html - 将鼠标悬停在元素上时光标不会改变

jquery - 使用 div 环绕的平滑 div 滚动

wordpress - Dockerfile 中的参数未作为执行命令传递

javascript - 在 WordPress 管理小部件表单中使用时,AngularJS 不更新 View

html - 在事件菜单项的左侧添加一个点

html - 当它们的宽度不适合它们的容器时,我如何垂直包装列?

jquery - 如何在将 jquery 与 css 一起使用后重置悬停功能

html - 显示问题 CSS

node.js - WordPress 和 React - 前端框架内部服务器错误