我从一个网站下载了一个 .css 样式表,其中包含许多表格样式。我想将该 .css 样式表应用于特定的 asp.net 表。所以在 aspx 中我有,
<asp:Table cssClass="downloadedCss">
</asp:Table>
在我下载的css样式表里面有很多东西比如..
table {}
caption{}
td, th {}
tr {}
thead th, tfoot th {}
tbody td a {}
tbody td a:visited {}
tbody td a:hover {}
tbody th a {}
tbody th a:hover {}
tbody td+td+td+td a {}
tbody td+td+td+td a:visited {}
tbody th, tbody td {}
tfoot td {}
tbody tr:hover {}
如何使所有这些 css 属性只适用于表格(downloadedCss 类)
最佳答案
ASP.NET 表格将呈现为 HTML 表格。
您的示例将呈现如下:
<table class="downloadedCss">
</table>
因此您当前的 CSS 规则将全部应用于此表格。如果您希望这些样式仅应用于此表格,请在 CSS 规则中指定类名。
table.downloadedCss {}
table.downloadedCss caption{}
table.downloadedCss td, table.downloadedCss th {}
table.downloadedCss tr {}
table.downloadedCss thead th, table.downloadedCss tfoot th {}
table.downloadedCss tbody td a {}
table.downloadedCss tbody td a:visited {}
table.downloadedCss tbody td a:hover {}
table.downloadedCss tbody th a {}
table.downloadedCss tbody th a:hover {}
table.downloadedCss tbody td+td+td+td a {}
table.downloadedCss tbody td+td+td+td a:visited {}
table.downloadedCss tbody th, table.downloadedCss tbody td {}
table.downloadedCss tfoot td {}
table.downloadedCss tbody tr:hover {}
关于css - 如何将 CSS 应用于特定的 asp.net 表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10395765/