Can I add an image to an ASP.NET button? Can I add an image to an ASP.NET button? asp.net asp.net

Can I add an image to an ASP.NET button?


Although you can "replace" a button with an image using the following CSS...

.className {   background: url(http://sstatic.net/so/img/logo.png) no-repeat 0 0;   border: 0;   height: 61px;   width: 250px}

...the best thing to do here is use an ImageButton control because it will allow you to use alternate text (for accessibility).


I actually prefer to use the html button form element and make it runat=server. The button element can hold other elements inside it. You can even add formatting inside it with span's or strong's. Here is an example:

<button id="BtnSave" runat="server"><img src="Images/save.png" />Save</button>