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

后端 未结 7 547
野趣味
野趣味 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:44

    You can add image to asp.net button. you dont need to use only image button or link button. When displaying button on browser, it is converting to html button as default. So you can use its "Style" properties for adding image. My example is below. I hope it works for you.

    Style="background-image:url('Image/1.png');"
    

    You can change image location with using

    background-repeat
    

    properties. So you can write a button like below:

    <asp:Button ID="btnLogin" runat="server" Text="Login" Style="background-image:url('Image/1.png'); background-repeat:no-repeat"/>
    
    0 讨论(0)
提交回复
热议问题