Text on an Image button in c# asp.net 3.5

<button runat="server" 
  style="background-image:url('/Content/Img/stackoverflow-logo-250.png')" >
  your text here<br/>and some more<br/><br/> and some more ....
  </button>

This tip from dotnetslave.com worked for me:

<asp:LinkButton 
    CssClass="lnkSubmit" 
    ID="lnkButton" 
    runat="server">SUBMIT</asp:LinkButton>

a.lnkSubmit:active
{    
    margin:0px 0px 0px 0px;
    background:url(../../images/li_bg1.jpg) left center no-repeat;
    padding: 0em 1.2em;
    font: 8pt "tahoma";
    color: #336699;
    text-decoration: none;
    font-weight: normal;
    letter-spacing: 0px;

}


You can't do that with ImageButton.

However, you can use a simple Button, set the text, and add a background image (bluebutton.gif) using CSS to achieve the desired effect.

Tags:

C#

Asp.Net