css - 如何将 CSS 应用于特定的 asp.net 表?

标签 css asp.net css-tables

我从一个网站下载了一个 .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/

相关文章:

javascript - 在动态添加的表行中丢失 css 样式

mysql - 数据库可伸缩性的最佳实践是什么

asp.net - 输入分配给扩展器的相同文本时,水印文本扩展器失败

html - 我页面上元素的对齐方式很奇怪

css - Bootstrap 搜索框和按钮与标题文本右侧对齐(不在导航栏中)

html - 完整的浏览器宽度列表,但文本具有最大宽度

c# - Azure 网站上的数据保护/加密?

html - 显示 :table div with percentage width 1px bug

javascript - 保持 table 上的垫片均匀

html - CSS 过渡不起作用