我想要一个包含我的 Gridview 的 div,但是我的 div 的 CSS 不起作用。这是代码:
<div class="grid">
<asp:GridView ID="GridView1" runat="server" CssClass="grid" CellPadding="1">
</asp:GridView>
</div>
我的 CSS 是这样的:
.grid{
float:right;
border:solid;
margin: 2px;
width:400px;
}
以及生成的 HTML :
<div class="grid">
<div>
<asp:GridView ID="GridView1" runat="server" CssClass="grid" CellPadding="1">
</asp:GridView>
</div>
</div>
甚至不显示边框。我不知道其他 div 是从哪里来的,但是当我在 Firebug 中的第二个 div 上应用样式时它起作用了。
最佳答案
HI 现在用于边框属性 像这样
.grid{
border:solid 2px red;
}
或者你可以这样试试
.grid{
border-style: solid;
}
The border CSS property is a shorthand property for setting the individual border property values in a single place in the style sheet. border can be used to set the values for one or more of: border-width, border-style, border-color.
更多关于 click here
边框样式 here
关于html - CSS 不适用于带有 Gridview 的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32432016/