假设我有一个带有菜单 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/