gpt4 book ai didi

html - CSS 背景图像不重复仅适用于 Firefox

转载 作者:行者123 更新时间:2023-11-28 05:19:54 25 4
gpt4 key购买 nike

.myclass{
background-image: url('http://image.flaticon.com/icons/svg/34/34164.svg');
background-repeat: no-repeat;
background-size:contain;
background-position: 1.5%;

}

表中我的所有行 (tr) 都有类 myclass: <tr class="myclass">在 Firefox 中,图像仅显示在表格第一列的所有单元格中,但在 chrome 和 opera 中,表格的所有单元格都有此背景图像。如何确保它只显示在 Chrome 和 Opera 的第一列中?

这是 html:

<table>
<tr class="myclass">
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr class="myclass">
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
</table>

最佳答案

这样设置

.myclass td:first-child {
background-image: url('http://image.flaticon.com/icons/svg/34/34164.svg');
background-repeat: no-repeat;
background-size:contain;
background-position: 1.5%;
}

http://codepen.io/brianmtreese/pen/XKwvqX

关于html - CSS 背景图像不重复仅适用于 Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39114845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com