简体   繁体   English

如何在容器(引导程序)中的另一个顶部显示一个 div?

[英]How to display a div on the top of another in a container (Bootstrap)?

I've added this div containing a date picker and I've done it in a form, since there will be more fields later, but the first one I've added displays next to the table, instead of above.我添加了这个包含日期选择器的div并在表单中完成了它,因为稍后会有更多字段,但我添加的第一个字段显示在表格旁边,而不是上面。 I've seen many answers to a similar question, but none applied to my situation.我已经看到很多类似问题的答案,但没有一个适用于我的情况。

This Fiddle shows it correctly.这个小提琴正确地显示了它。

Here's the container's piece of code:这是容器的一段代码:

<div class="container-fluid" id="container">
  <br>
  <div id="page" style="color:#373737">
    <div class="row justify-content-around" id="selectFieldsDiv">
      <div class="col-md-3 form-group">
        <label for="agencySelect">Choose</label>
        <select id="agencySelect" onchange="loadClientsFromSS(selectedAgency())">
          <option value=""></option>
          <option value="option1">Option1</option>
        </select>
      </div>

      <div class="col-md-3 form-group">
        <label for="clientSelect">Choose</label>
        <select id="clientSelect" onchange="loadClientTasks(selectedClient())">
          <option value="dsadads">Option1</option>
        </select>
      </div>

      <div class="col-md-3 form-group">
        <div id="addTaskBtnSpot"><button id="addTaskBtn" type="submit" class="btn btn-primary" onclick="addTaskFields()">Add task</button></div>
        <div id="cancelTaskBtnSpot"></div>
      </div>
    </div>
  </div>

  <br>
  <div id="addTaskFieldsDiv">
    <form>
      <label for="birthday">Birthday:</label>
      <input type="date" id="birthday" name="birthday">
    </form>
  </div>

  <div class="row" id="tableDiv">
    <div class="col">
      <div id="search-results" class="table-responsive">
        <div class="card" id="card">
          <table class="table table-borderless table-hover" id="dtable">
            <thead style="white-space: nowrap">
              <tr>
                <th style="width: 4%" class="text-center">Client ID</th>
                <th style="width: 4%" class="text-center">Task No</th>
                <th style="width: 25%" class="text-center">Task</th>
              </tr>
            </thead>

            <tbody>
              <tr>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">AC002</td>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">1</td>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">Review and approve on page recommendations</td>
              </tr>

              <tr>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">AC002</td>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">2</td>
                <td class="align-middle" style="word-wrap: break-word;max-width: 160px;text-align:center">Review and approve content recommendations</td>
              </tr>
            </tbody>
          </table>
        </div>

        <br>
      </div>
    </div>
  </div>
</div>

Appreciate our help!感谢我们的帮助!

这是它的样子,最右边的桌子

First of all remove the <br> and <div id="page"> because this (might) breaks the Bootstrap container>row>col layout.首先删除<br><div id="page">因为这(可能)会破坏 Bootstrap container>row>col 布局。

<div class="container-fluid" id="container">
    <br />
    <div id="page" style="color: #373737">
        <div class="row justify-content-around" id="selectFieldsDiv">

Then because the datepicker is located within the Bootstrap container start the layout with a proper row and column to wrap the form/datepicker in like so:然后因为 datepicker 位于 Bootstrap 容器中,所以用适当的行和列开始布局,以像这样包装表单/datepicker:

<div id="addTaskFieldsDiv" class="row">
    <div id="addTaskFieldsDiv" class="col">
        <form>
            <label for="birthday">Birthday:</label>
            <input type="date" id="birthday" name="birthday" />
        </form>
    </div>
</div>

Make sure to repeat this pattern (container>row>col) throughout the document and see if fits your needs.确保在整个文档中重复此模式(容器>行>列),看看是否符合您的需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM