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

后端 未结 7 545
野趣味
野趣味 2020-12-20 11:17

I want to add an image, instead of the default button.

I already have a CSS class for the image, will this work?



        
7条回答
  •  时光说笑
    2020-12-20 11:29

    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).

提交回复
热议问题