【问题标题】:Display content in two columns using html使用html在两列中显示内容
【发布时间】:2018-04-10 18:46:36
【问题描述】:

我试图在 HTML5 的两列中显示内容。但是,不知何故,我做错了什么。这是我的 HTML 代码

.column1 {
  float: left;
  width: 70%;
}
<div class="cd-admin-upper-container container-fluid">
  <div class="row">
    <div class="column1">
      <h1>Device UnAssignment</h1>
      <div>
        <div class="alert alert-info" style="height : 50%; margin-bottom : 2vw;width: 40%">
          <label class="cd-admin-create-modal-label">Patient Name: </label>
          <label class="cd-admin-create-modal-label">Device Serial Number: </label>
        </div>
        <div>
          <button type="submit" class="btn btn-primary" style="margin-left: 3%"
          ng-click="unassignDevice(device.patientId);"><span title="UnAssign Device"></span> UnAssign
          </button>
        </div>
      </div>
      <div class="column2">
        <h1>Device Assignment</h1>
        <p>Hello this is column two</p>
      </div>
    </div>
  </div>
</div>

这是 JSFiddle 链接 - http://jsfiddle.net/chandham/k39vpafd/

【问题讨论】:

标签: css html two-column-layout


【解决方案1】:

我以某种方式将 column1 和 column2 嵌套在同一个 div 中。这是更新后的代码。

<div class="cd-admin-upper-container container-fluid">
    <div class="row">
        <div class="column1">
            <h1>Device UnAssignment</h1>
            <div class="alert alert-info" style="height : 50%; margin-bottom : 2vw;width: 40%">
                <label class="cd-admin-create-modal-label">Patient Name: </label>
                <label class="cd-admin-create-modal-label">Device Serial Number: </label>
            </div>
            <div>
                <button type="submit" class="btn btn-primary" style="margin-left: 3%" ng-click="unassignDevice(device.patientId);"><span title="UnAssign Device"></span> UnAssign
                </button>
            </div>
        </div>
        <div class="column2">
            <h1>Device Assignment</h1>
            <p>Hello this is column two</p>
        </div>
    </div>
</div>

【讨论】:

  • 它是对您自己问题的回答还是对问题的编辑?因为它仍然不起作用。
  • 当我运行代码 sn-p 时,我没有看到相邻的 2 列,这就是我问的原因。相反,我看到第 1 列下方的第 2 列。也许我不明白您想要实现的目标。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-04
  • 2020-05-08
  • 1970-01-01
  • 2016-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多