简体   繁体   中英

Background image for button not working

Hi I have a button in my form that triggers a pop up calendar for a date feild. I am trying to change the background image for the button with a calendar that I png image but cant get it to work

Here is the code

<asp:Button ID="btn_date" runat="server" Height="32px" Width="32px"
                                    CssClass="style60" Text="C" />

here is the css

.style60

        {

            background-image:url ("Pics/calendar.png");
            background-position: top;

        }

The size of the image is also 32x32 px.

Try using the ImageButton controller as per below sample:

<asp:ImageButton id="btn_date" runat="server"
           AlternateText="ImageButton 1"
           ImageAlign="left"
           ImageUrl="Pics/calendar.png"
           OnClick="ImageButton_Click"/>

try modifying the path of the image as shown below:

.style60

        {

            background-image:url ("./Pics/calendar.png");
            background-position: top;

        }

Try using an ImageButton instead of Button .

Code

<asp:ImageButton ID="btn_date" runat="server" Height="32px" Width="32px"
                 ImageUrl="~/Pics/calendar.png" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM