我正在帮助设计Volusion中的站点,并尝试样式化没有span id的表。由于该表是从Volusion自动生成的,因此无法添加范围ID。我进入CSS并尝试一切都无济于事。这是当前代码的一小段:
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
<tr class="colors_backgroundlight">
<td>Item#</td>
<td>Item Name</td>
<td><span class="PageText_L335n"><b>Starting at</b></span></td>
<td><span class="PageText_L71n">Qty</span></td>
<td><b><span class="PageText_L337n">Add</span></b></td>
</tr>
<tr bgcolor="#FFFFFF" class="Multi-Child_Background">
<td class="smalltext colors_text">NFBM665-S</td>
<td class="productnamecolorSMALL colors_productname">Foil Thermal Bubble Mailer, 6" x 6.5" Sample</td>
不幸的是,页面上还有其他表格,所以我不知道该怎么办。我可以使用仅针对此特定表的任何类型的Javascript代码吗?感谢您的任何帮助。
在JavaScript中隔离表格的问题与在CSS中隔离表格的问题相同。
CSS样式除了可以使用以外,还可以基于多种方式应用id
。该表在DOM中的相对位置(如果是静态的)将是我的下一个选择。
根据您的方案中的DOM,您拥有一个span
元素,该元素是table
您所追求的元素的同级元素。这span
具有id
的product_description
,这使得它在文档中是唯一的。以下内容将表作为跟随以下元素的同级元素span
:
#product_description ~ table { background:yellow; }
#product_description ~ table td { padding:25px; }
<span id="product_description" itemprop="description">
Please Note: For Thermal Bubble Mailer samples, we charge $5.95 for shipping and handling for each sample.<br />
1 sample per item, per customer. Coupon codes cannot be applied to samples.<br /><hr />
</span>
<br /><br />
<div style='height: 15px;'></div>
<div style='clear: both;'></div>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
<tr class="colors_backgroundlight">
<td>Item#</td>
<td>Item Name</td>
<td><span class="PageText_L335n"><b>Starting at</b></span></td>
<td><span class="PageText_L71n">Qty</span></td>
<td><b><span class="PageText_L337n">Add</span></b></td>
</tr>
<tr bgcolor="#FFFFFF" class="Multi-Child_Background">
<td class="smalltext colors_text">NFBM665-S</td>
<td class="productnamecolorSMALL colors_productname">Foil Thermal Bubble Mailer, 6" x 6.5" Sample</td>
</tr>
</table>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句