【问题标题】:How do I make the text in the header of my table not bold?如何使表格标题中的文本不加粗?
【发布时间】:2015-05-22 00:31:53
【问题描述】:

我需要为我的表格使用行跨度,因此我(相信)我必须使用表格标题。但是,使用表头会使我的字体变粗,这是不需要的。对于这个 HTML,我如何确保表头中的字体不是粗体?或者,如果可能的话,如何在不使用表头的情况下使用行跨度?

<table border="1">
  <tr>
    <th rowspan="2">Telephone:</th>
<td>555 77 854</td>
  </tr>
  <tr>
    <td>555 77 855</td>
  </tr>
</table>

【问题讨论】:

    标签: html text html-table tableheader


    【解决方案1】:

    只需在 CSS 中隐藏 th 元素的 font-weight 即可:

    th{
        font-weight: normal;
    }
    

    JSBin : http://jsbin.com/lizakatuwe/1/

    【讨论】:

      【解决方案2】:
      <table border="1">
        <tr>
          <tr rowspan="2"><p style="font-weight:bold>Telephone:</p></tr>
      <td>555 77 854</td>
        </tr>
        <tr>
          <td>555 77 855</td>
        </tr>
      </table>
      

      我正在为您使用内部 CSS,直接在您的表格中插入字体样式。 将此代码复制并粘贴到您的项目中,它就可以完成这项工作。

      【讨论】:

        【解决方案3】:

        你根本不需要表头,你也可以使用rowspantd。要使其不加粗,请将 css 中的 font-weight 覆盖为 normal

        【讨论】:

          猜你喜欢
          • 2011-01-20
          • 1970-01-01
          • 1970-01-01
          • 2016-03-13
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-01-08
          • 1970-01-01
          相关资源
          最近更新 更多