asp.net - CSS 如何与 ASP.NET Web 控件一起使用?

标签 asp.net css

假设我有一个带有菜单 Web 控件的 aspx 页面。菜单 Web 控件在浏览器上呈现为 html 表格。我的计划是在将发送到浏览器的 aspx 页面上添加 css 样式。假设我将以下样式添加到 aspx 页面

td
{
    background-color: Red;
}

此样式与呈现的 html 表格一起发送到浏览器

<table>
   <tr>
       <td>...</td>
       <td>...</td>
   </tr>
   <tr>
       <td>...</td>
       <td>...</td>
   </tr>
</table>

但是没有应用样式。我真的很困惑为什么会这样。一般而言,我们如何预测 CSS 对 ASP.NET wen 控件的影响?

最佳答案

菜单覆盖了一些样式。

大多数 ASP.NET 控件公开一个 CssClass 属性,您应该使用它来为控件分配样式。

关于asp.net - CSS 如何与 ASP.NET Web 控件一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3429372/

相关文章:

c# - ASP :Image ImageUrl calling function

javascript - 更改持有 web 方法的 aspx 页面的 url 后,Jquery .ajax 不起作用

c# - 如何从 C# WebAPI 返回多个值?

ASP.NET 路由 : RouteCollection class missing

css - thead 和 tbody 之间的间距

javascript - 我怎样才能为这个js中的每个类元素获得唯一的id

html - 在没有 rtl 的表中将文本溢出到左侧

javascript - sharp (#) (e.g. #{$variable}) 在 SCSS 中是什么意思?

c# - 如何从 .NET 调用 C 库

html - 我的专栏只有在我给行类时才有效