【问题标题】:Why does my table head get a color when css is empty and I dont style the table in my html?为什么当 css 为空并且我没有在我的 html 中设置表格样式时,我的表头会变颜色?
【发布时间】:2020-06-11 09:27:54
【问题描述】:

好的,所以我的页面是这样的:

如您所见,标记为“Detailansicht Telefonnummer”的背景为蓝色,我不知道它来自哪里。 css 文件是空的,它是一个 Angular 组件。任何帮助表示赞赏。

phonenumber-detail.html:

<table>
    <tr>
      <th>ID</th>

    </tr>
    <tr>
       <td>{{id}}</td>

    </tr>

</table>

<br>
<button (click)="blockPhoneNumber((phonenumber))">Manuell sperren</button>
<br>
<button (click)="unblockPhoneNumber((phonenumber))">Entsperren</button>
<br>
<button (click)="reservePhoneNumber((phonenumber))">Reservieren</button>

<table style='text-align:left'>
  <thead>
    <tr>
       <th colspan="2"><h3>Detailansicht Telefonnummer</h3></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td width= '200'><b>Nummer:</b></td>
      <td></td>
    </tr>
    <tr>
      <td><b>Typ:</b></td>
      <td></td>
    </tr>
    <tr>
      <td><b>Letzte Änderung:</b></td>
      <td></td>
    </tr>
    <tr>
      <td><b>Geändert durch:</b></td>
      <td></td>
    </tr>
  </tbody>
</table>

<br />

<button (click)="goBack()" class="btn btn-primary" style="margin: 0 20px">zurück</button>
<button (click)="goBack()" class="btn btn-primary" style="margin: 0 20px">blockieren</button>
<button (click)="goBack()" class="btn btn-primary" style="margin: 0 20px">reservieren</button>

【问题讨论】:

  • 您是否尝试使用 chrome devtools 检查元素?
  • 必须用 ctrl + shift + R 重新加载页面
  • 页面已重新加载。它在进行更改后重新加载,因为我使用“--poll=2000”启动服务器
  • 每次重新加载页面时都会发生这种情况吗?
  • 我刚刚用开发者工具检查过了。不知何故,我的 h3 是蓝色的。但在我的 css 文件中,我没有设置 h3 样式!

标签: html css angular html-table


【解决方案1】:

table th h3 {
  background: transparent !important;
}

table th h3.bg-default {
  background: transparent !important;
}
solution 1-
<th colspan="2"><h3>Detailansicht Telefonnummer</h3></th>
<hr>
solution 2-
<th colspan="2"><h3 class="bg-default">Detailansicht Telefonnummer</h3></th>

试试这样...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-23
    • 1970-01-01
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多