I have the following table* column and class, and yet when the table is rendered in Firefox, the class is missing.
<td class="item-template-readmore">
<a href='Detail.aspx?id=<%# Eval("id") %>'>Read More</a>
</td>
.item-template-readmore
{
color: Red;
}
Yet, when I have this combination of column and class, the class is present in the browser.
<td class="item-template-name">
<%# Eval("Name") %>
</td>
.item-template-name
{
color: Red;
}
Logically this is wrong. The only difference I can see is that the ‘operational’ column doesn’t have child elements (except for text), and I know this is the rabbit hole of CSS, but surely the styling on the containing element shouldn’t even be aware of the contained elements?
- Tables, I know, ain’t it evil 🙂
As @meder implies, it’s not that the
tablecells are aware of their content, it’s that the contents are aware of their own existence. Theaelements apply their own styles, therefore instead of styling the table cell you should style thea:a {
color: red;
}
Assuming that you want differentiation between the various states of the
a:You can also preface these styles with
tableand/or the column’s class to increase specificity:You could also, if you wanted to, use
inheritto force theaelements to inherit properties from their parent element: