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; }
精彩评论