我正在尝试使用 :nth-child(5); 拉伸(stretch)背景上的图像以进行第三次打印。但它没有捕获它。我做错了什么吗?
table#OppPracticeOverview tr th {
padding:5px !important;
background-color:transparent;
}
table#OppPracticeOverview tr th img {
width:47px;
height:22px;
float:left;
margin:-5px 0 0 -42px;
position:absolute;
z-index:-1;
}
table#OppPracticeOverview tr th img:nth-child(5) {
width:110px;
height:22px;
float:left;
margin:-5px 0 0 -105px;
position:absolute;
z-index:-1;
}
HTML:
<table id="OppPracticeOverview">
<tbody>
<tr>
<th>
Patients
<img src="/images/img-CCCCCC.png">
</th>
<td>
<th>
On Hold
<img src="/images/img-CCCCCC.png">
</th>
<td>
<th>
Reattribution Request
<img src="/images/img-CCCCCC.png">
</th>
<td>
</tr>
</tbody>
最佳答案
你几乎是对的,只需将 nth-child
从 img
移动到 th
即可,如下所示:table#OppPracticeOverview tr th :nth-child(5) img
关于html - :nth-child() not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15881468/