我有一张桌子
<table class="historystyle" >
<tr>
<th > name</th>
<th >location</th>
<th > job</th>
<tr>
</table>
在
name
标头中,我不想应用background-image
样式,因此我将其放在div元素中并设置style="background-image: none;
但是它不起作用.name标头仍然显示
backgorund image
。我的代码出了什么问题。.请帮助<table class="historystyle" >
<tr>
<th><div style="background-image: none; ">name</div></th>
<th>location</th>
<th> job</th>
<tr>
</table>
样式
.historystyle th{
border: 1px solid black;
background-image: url(../images/bg.gif);
cursor: pointer;
}
最佳答案
您需要将style="background-image: none"
应用于th
本身:
<table class="historystyle" >
<tr>
<th style="background-image: none">name</th>
<th>location</th>
<th> job</th>
<tr>
</table>
将其应用于
div
不会影响th
的显示方式。默认情况下,(大多数)HTML元素是透明的,因此div
没有背景,但是您可以直接看到th
,它仍然有背景。关于jquery - 在表格标题中应用不同的样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24008647/