如何使用 CSS 优化此网页 space?

How to make this web page space-optimized using CSS?

我有这个小网页:

这是源代码:

<head>
  <meta charset="UTF-8">
  <style>
    body {
      margin-left: 20px;
      margin-top: 20px;
    }
    
    h1 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h2 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h3 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h4 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h5 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h6 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    hr {
      height: 3px;
      border-radius: 2px;
      border-width: 0;
      color: lightgray;
      background-color: lightgray;
    }
    
    .button {
      display: inline-block;
      background-color: darkgray;
      color: white;
      text-decoration: none;
      border-radius: 2px;
      padding: 6px;
      margin-left: 2px;
      margin-right: 2px;
    }
    
    .button:hover {
      color: black;
    }
    
    .button:visited {
      color: white;
    }
    
    .button:active {
      color: white;
    }
    
    a {
      color: gray;
    }
  </style>
</head>

<body nyxt-identifier="0">
  <style nyxt-identifier="1">
    body {
      margin-left: 20px;
      margin-top: 20px;
    }
    
    h1 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h2 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h3 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h4 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h5 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    h6 {
      font-family: Helvetica Neue, Helvetica;
      font-weight: 500;
    }
    
    hr {
      height: 3px;
      border-radius: 2px;
      border-width: 0;
      color: lightgray;
      background-color: lightgray;
    }
    
    .button {
      display: inline-block;
      background-color: darkgray;
      color: white;
      text-decoration: none;
      border-radius: 2px;
      padding: 6px;
      margin-left: 2px;
      margin-right: 2px;
    }
    
    .button:hover {
      color: black;
    }
    
    .button:visited {
      color: white;
    }
    
    .button:active {
      color: white;
    }
    
    a {
      color: gray;
    }
  </style>
  <h1 nyxt-identifier="2">Bindings</h1>
  <p nyxt-identifier="3">
  </p>
  <div nyxt-identifier="4">
    <h3 nyxt-identifier="5">override-map</h3>
    <table nyxt-identifier="6">
      <tbody nyxt-identifier="7">
        <tr nyxt-identifier="8">
          <td nyxt-identifier="9">C-S
          </td>
          <td nyxt-identifier="10">search-buffers
          </td>
        </tr>
        <tr nyxt-identifier="11">

          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <div nyxt-identifier="44">
    <h3 nyxt-identifier="45">web-cua-map</h3>
    <table nyxt-identifier="46">
      <tbody nyxt-identifier="47">
        <tr nyxt-identifier="48">
          <td nyxt-identifier="49">f3
          </td>
          <td nyxt-identifier="50">search-buffer
          </td>
        </tr>
        <tr nyxt-identifier="51">

          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <div nyxt-identifier="195">
    <h3 nyxt-identifier="196">base-cua-map</h3>
    <table nyxt-identifier="197">
      <tbody nyxt-identifier="198">
        <tr nyxt-identifier="199">
          <td nyxt-identifier="200">f5
          </td>
          <td nyxt-identifier="201">reload-current-buffer
          </td>
        </tr>
        <tr nyxt-identifier="202">

          </td>
        </tr>
      </tbody>
    </table>
  </div>
</body>

上面的代码和图片是对实际问题的简化。在实际问题中,页面要大得多,因为 table 的元素比当前显示的要多。

我想以更好的方式使用 space,这样打印它就不会花费太多纸张。屏幕右侧有很多 space 被浪费了。

内容在横向上可以更广泛地传播,而不是在纵向上

实现此目标的两种可行方法是 (i) 减小字体大小,以及 (ii) 使 table 成为 2 列-table 或 3 列,而不是1 列。

好的。我可以使用 CSS:

减小字体大小
tr { font-size: 10px}

因此,请问:

1 - 如何使用 CSS 使 table 成为 3 列或 2 列 table?

我按照 W3C 上的 example 尝试了这种方法:

table {
  column-span: all;
}

但是没有成功。

2 - 除了调整字体和列号以最大限度地利用 space 并减少纸张的使用之外,您还有什么建议吗?

这个一点都不复杂。您只需将所有键绑定和标题放在 one table 中,而不是每个都放在它自己的中。然后,我们使用一点 CSS 在 table 单元格之间获得一条小边框线 - 如果您不需要边框,只需删除 CSS 部分。像这样:

table {
  border-spacing: 0;
}

td {
  border: 1px solid black;
  padding: 10px;
}
<h1>Bindings</h1>
<table>
  <tbody>
    <tr>
      <td colspan="2">
        override-map
      </td>
      <td colspan="2">
        web-cua-map
      </td>
      <td colspan="2">
        base-cua-map
      </td>
    </tr>
    <tr>
      <td>
        C-S
      </td>
      <td>
        search-buffers
      </td>
      <td>
        F3
      </td>
      <td>
        search-buffer
      </td>
      <td>
        F5
      </td>
      <td>
        reload-current-buffer
      </td>
    </tr>
  </tbody>
</table>