html - CSS,如何设置布局

标签 html css

我有以下代码来显示表格

<div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> 
  <a href="#close" class="closeTopologyBalloon">×</a>
  <div class="contentBody">

    <table class="detailInfoTable">
      <caption>private</caption>
      <tbody>
        <tr>
          <th class="device">ID</th>
          <td>c2f03b99-6d62-43c4-9a35-4b4cbf22a7db</td>
        </tr>
        <tr>
          <th class="device">status</th>
          <td>
            <span class="active">ACTIVE</span>
          </td>
        </tr>
      </tbody>
    </table>

    <table class="detailInfoTable">
      <caption>subnets</caption>
      <tbody>
        <tr>
          <th>
            <span title="cc59732b-4ce8-4aae-bab5-fac80c135440">
              <a href="/dashboard/project/networks/subnets/cc59732b-4ce8-4aae-bab5-fac80c135440/detail">cc59732b-4ce8-4aae-bab5-fac80c135440</a>
            </span>
          </th>
          <td>10.10.10.0/24</td>
        </tr>
    <tr>
          <th>
            <span title="4394b976-f98c-4696-8348-5f6c78a8987e">
              <a href="/dashboard/project/networks/subnets/4394b976-f98c-4696-8348-5f6c78a8987e/detail">4394b976-f98c-4696-8348-5f6c78a8987e</a>
            </span>
          </th>
          <td>10.10.11.0/24</td>
        </tr>
  </tbody>
    </table>

  </div>
  <div class="footer">
    <div class="footerInner">
      <div class="cell link">
        <a href="/dashboard/project/networks/c2f03b99-6d62-43c4-9a35-4b4cbf22a7db/detail">» check detail information</a>
      </div>
    </div>
  </div>
</div>

和 CSS 文件

table, th, td{
  border: 0px solid blue;
}

caption {
    font-weight: bold;
}

th {
    color: #D0D0D0;
}

.active {
    display:block;
    margin-right:5px;
    border-radius:10px;
    width:9px;
    height:9px;
    background-color:#ff6f0b
}

输出看起来像这样 enter image description here

如何缩进表格并划线来分隔拖车台?以下是输出

enter image description here

最佳答案

希望你需要这样的东西:

table, th, td{
  border: 0px solid blue;
}

caption {
    font-weight: bold;
    text-align: left
}

th {
    color: #D0D0D0;
}


.active::before {
  content: " ";
  display:inline-block;
  border-radius:10px;
  width:9px;
  height:9px;
  background-color:#ff6f0b;

}
<div class="topologyBalloon" id="bl_c2f03b99-6d62-43c4-9a35-4b4cbf22a7db"> 
  <a href="#close" class="closeTopologyBalloon">×</a>
  <div class="contentBody">

    <table class="detailInfoTable">
      <caption>private</caption>
      <tbody>
        <tr>
          <th class="device">ID</th>
          <td>c2f03b99-6d62-43c4-9a35-4b4cbf22a7db</td>
        </tr>
        <tr>
          <th class="device">status</th>
          <td>
            <span class="active">ACTIVE</span>
          </td>
        </tr>
      </tbody>
    </table>
<HR/>
    <table class="detailInfoTable">
      <caption>subnets</caption>
      <tbody>
        <tr>
          <th>
            <span title="cc59732b-4ce8-4aae-bab5-fac80c135440">
              <a href="/dashboard/project/networks/subnets/cc59732b-4ce8-4aae-bab5-fac80c135440/detail">cc59732b-4ce8-4aae-bab5-fac80c135440</a>
            </span>
          </th>
          <td>10.10.10.0/24</td>
        </tr>
    <tr>
          <th>
            <span title="4394b976-f98c-4696-8348-5f6c78a8987e">
              <a href="/dashboard/project/networks/subnets/4394b976-f98c-4696-8348-5f6c78a8987e/detail">4394b976-f98c-4696-8348-5f6c78a8987e</a>
            </span>
          </th>
          <td>10.10.11.0/24</td>
        </tr>
  </tbody>
    </table>

  </div>
  <div class="footer">
    <div class="footerInner">
      <div class="cell link">
        <a href="/dashboard/project/networks/c2f03b99-6d62-43c4-9a35-4b4cbf22a7db/detail">» check detail information</a>
      </div>
    </div>
  </div>
</div>

关于html - CSS,如何设置布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43992765/

相关文章:

html - 将默认值设置为 html 中的空白表单。(Ruby、Sinatra、CSS)

css - 新扩展可能需要许可?

css - Zurb 基础柱宽度不起作用

javascript - 输入 2 个类,javascript 影响其中一个的边框颜色

html - Selenium:通过可见文本查找元素

html - CSS/HTML IE 不会在 Bootstrap 按钮的右侧留下边距

javascript - 在初始按钮单击时从 html 图像转换为 png 图像

javascript - 如何根据内容大小动态调整或调整div的背景图片

javascript - 导航栏页面跳转URL添加滚动动画

jquery - "How to fix ' 混合内容 : The page was loaded over HTTPS, 但请求不安全的脚本”