Why are some tables randomly inheriting this css style?
It seems like some tables are inheriting styles that they shouldn't.
I have a custom table class, and I want only tables that use that class to have a 1px width solid border, but for some reason other tables seem to use it randomly.
Here's the CSS for it:
.my_custom_table td, th { border: 1px solid gray; }
and here's the markup for a table that uses it for some reason:
<table border="0" cellspacing="0" cellpadding="2" class="customer-info"> ... </table>
I'm thinking the style says "for all td and td under the class .my_custom_table - use 1px solid border", or am I missing something?
Your CSS will apply to all <th>
tags, not just those under the my_custom_table
class.
Try this instead:
.my_custom_table td, .my_custom_table th { border: 1px solid gray; }
.my_custom_table td, th
means all the td
elements in something with a my_custom_table
class AND all of the th
elements. Notice that's not all the th
in something with a my_custom_table
class. Just all the th
.
.my_custom_table td, .my_custom_table th
is what you want.
链接地址: http://www.djcxy.com/p/88794.html上一篇: 为什么Nodejs不支持Web Audio API?
下一篇: 为什么有些表会随机地继承这个CSS风格?