gpt4 book ai didi

CSS表命名

转载 作者:行者123 更新时间:2023-12-03 07:49:36 26 4
gpt4 key购买 nike

有什么方法可以重命名此 CSS 代码以仅影响某个表格而不是我网站上的所有表格?

 th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
}

th.nobg {
border-top: 0;
border-left: 0;
background: #C1DAD7;
}

td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}

td.alt {
background: #F5FAFA;
color: #797268;
}

th.spec {
border-left: 1px solid #C1DAD7;
border-top: 0;
background: #fff;
font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

th.specalt {
border-left: 1px solid #C1DAD7;
border-top: 0;
background: #f5fafa;
font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #797268;
}

和 HTML 代码:

 <table id="mytable" cellspacing="0"> 
<tr>
<th width="202" class="nobg" scope="col">Configurations</th>
<th width="250"></th>
</tr>
<tr>
<th scope="row" class="spec">Model</th>
<td>M9454LL/A</td>
</tr>
<tr>
<th scope="row" class="specalt">G5 Processor</th>
<td class="alt">Dual 1.8GHz PowerPC G5</td>
</tr>
<tr>
<th scope="row" class="spec">Frontside bus</th>
<td>900MHz per processor</td>
</tr>
<tr>
<th scope="row" class="specalt">Level2 Cache</th>
<td class="alt">512K per processor</td>
</tr>
</table>

最佳答案

您可以更改 CSS 选择器以仅匹配特定的表 ID,例如...

#mytable th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
}

#mytable th.nobg {
border-top: 0;
border-left: 0;
background: #C1DAD7;
}

#mytable td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}

关于CSS表命名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3191730/

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