How to set css style to asp.net button?


Tags: asp.net,css,button,aspbutton

Problem :

I have a asp:Button, I used css styles with cssClass property in asp:Button, but those styles are not working. When I use asp:LinkButton those styles are working well.I don't want any themes or skins for styles.

This is my asp page:

<asp:Button CssClass="smallButton" Text="Sign In" runat="server" ID="submit"></asp:Button>

This is my CSS:

.smallButton 
{
  //styles
}

When I change asp:Button to asp:LinkButton

<asp:LinkButton Text="Sign In" runat="server" ID="submit" CssClass="smallButton"></asp:LinkButton>

or

<span class="smallButton"><asp:LinkButton Text="Sign In" runat="server" ID="submit"></asp:LinkButton></span>

styles are working well. Only problem with the asp:Button control



Solution :

I Found the coding...

 input[type="submit"]
    {
     //css coding
    }
 input[type="submit"]:Hover  
    {
     //css coding
    }

This is the solution for my issue..... Thanks everyone for the valuable answers.......


    CSS Howto..

    “show/hide” a div with javascript not jquery, and not with display:none

    How to properly align something that resizes in a specific location

    I have a video background on my bootstrap page - how can I make it “fixed”?

    How to make background-image size height always equal what the image height needs to be for full width image?

    How to Make Tabs In CSS?

    Implementing a select element in my form, but unsure how to grab user selection for a list

    How to change an image on click using CSS alone?

    How to set negative z-index with jQuery?

    css float: left clash/collision, how to avoid?

    How to make agile layout?

    How can I make it so that my logo on the top left of the page lines up with the text underneath it?

    Rails 4: how to identify and format links, hashtags and mentions in model attributes?

    How do I configure syntax highlighting for LESS in coda?

    How to change my css code to fit the footer to the bottom of the page for any size of monitor?

    How to get the Tololtip Tail for Menu

    How to make a background with 45 degree lines with css?

    How can I get a block to print complicated divs horizontally?

    How can I add block colour to the CSS of my list?

    CSS - how to put a opacity border to an input?

    how to set zoom level using css

    How to move last li to right most side CSS

    How to get the value of css property with jQuery

    How to make the css affect the new content loaded by jquery?

    How can I take advantage of Sass, for example, in rendering FizzBuzz?

    How to hide a part of a CSS borderline nicely

    How to achieve this awesome CSS animation

    How to set a image/icon width that was specified through css content property?

    How to style 404 page in WAMP server

    How can I use jQuery (or CSS) to sort HTML tables by column?

    How to let the user choose a page number?