Html 如何使表格标题中的文本不粗体?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29135354/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:42:05  来源:igfitidea点击:

How do I make the text in the header of my table not bold?

htmltexthtml-tabletableheader

提问by Demi

I need to use a rowspan for my table, therefore I (believe) I must use a table header. However, using a table header makes my font bold, which is unwanted. For this HTML, how would I make sure the font in my table header isn't bold? Or, if it's possible, how can I use rowspan without using a table header?

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

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

回答by Drown

Simply overhide the font-weightof the thelement in CSS :

简单地覆盖CSSfont-weight中的th元素:

th{
    font-weight: normal;
}

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

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

回答by orion

You don't need table header at all, you can use rowspanwith tdtoo. To make it not bold, override the font-weightin css to normal.

您根本不需要表头,也可以使用rowspanwith td。要使其不粗体,请将font-weightin css覆盖为normal.

回答by Anson A?tepta

<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>

I am using internal CSS for you, directly insert the font style inside your table. Copy and pasta this code into your project, it will do the job.

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