html - 未应用主题样式

标签 html css html-table

对于下表,thead 元素中的文本不响应任何 CSS 规则。

我认为它会继承 table.declensionTable 元素的规则,但事实并非如此。

我使用 table.declensionTable thead 选择创建了一个 CSS 规则,但这也不起作用。

我做错了什么?

body {
  font-family: "Verdana", Sans-serif;
}


table.declensionTable{
  font-family: "Courier New", Serif;
  border: 1px solid black;
  border-color: #000000;
  border-collapse: collapse;
  margin-bottom: 10px;
}

table.declensionTable thead{
  font-family: "Courier New", Serif;


}

table.declensionTable th{
  border: 1px solid black;
  border-color: #000000;
  border-collapse: collapse;

}

table.declensionTable td{
  border: 1px solid black;
  border-color: #000000;
  border-collapse: collapse;

}
<table class="declensionTable">
  <thead><strong>klub</strong>: <em>club</em>; an inanimate masculine noun</thead>
  <tbody>
    <tr>
      <th></th><th>Singular</th><th>Plural </th>
    </tr>
    <tr>
      <td><strong>Nom</strong></td> <td>klub</td> <td>kluby</td>
    </tr>
    <tr>	
      <td><strong>Gen</strong></td> <td>klubu</td> <td>klubów</td> 
    </tr>
    <tr>
      <td><strong>Dat</strong></td> <td>klubowi</td> <td>klubom</td>
    </tr>
    <tr>
      <td><strong>Acc</strong></td> <td>klub</td>    <td>kluby</td>
    </tr>
    <tr>
      <td><strong>Inst</strong></td> <td>klubem</td> <td>klubami</td>
    </tr>
    <tr>
      <td><strong>Loc</strong></td>  <td>klubie</td> <td>klubach</td>
    </tr>
    <tr>
      <td><strong>Voc</strong></td>  <td>klubie</td> <td>kluby</td>
    </tr>
  </tbody>
</table>

最佳答案

您没有正确使用 thead 元素。它是用于对标题内容进行分组的行的容器。如果在 thead 中添加一行,它应该会按预期显示。

The <thead> element must have one or more <tr> tags inside.

http://www.w3schools.com/tags/tag_thead.asp

关于html - 未应用主题样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30772353/

相关文章:

javascript - 导航栏顶部固定收缩,带有无重叠的旋转木马

jquery - 连续执行 Action

html - 如何从具有 `display: table` 的 div 设置表头以坚持到顶部

html - 如何使用媒体查询删除 html 表的特定列以使其他数据可见(响应)?

javascript - 将网格布局应用于表时出现间隙

php - 包含父目录中的页眉和页脚但不显示 css

javascript - 在高级搜索选项卡抽屉中实现页脚

html - Bootstrap 。无法更改导航栏链接颜色。即使有身份证

html - 如何调整图像大小并适合CSS中的容器(div)

html - IE风格完全乱了