开发者

Styling asp.net controls

I'm hoping someone can help me with this.

When I'm styling html components say all divs on the page I would add a CSS like:

div
{
  background-color:Red;
}

whic开发者_JAVA技巧h works fine. However when it come to styling an asp.net control say a button I try:

button
{
  background-color:Red;
}

but this doesn't work. Could someone please tell me how you style these creatures?


An asp.net button is actually an input element. So to style it you would use:

input { background-color: red; }

But that would style all input elements (text boxes, button, radio buttons, check boxes). To target just buttons you can use some CSS3:

input[type=button] { background-color: red; }

Or, you can just give all the buttons you want to style a class and do it that way:

<asp:Button runat="server" CssClass="red-button" />

.red-button { background-color: red; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜