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

后端 未结 9 1016
情话喂你
情话喂你 2020-12-03 17:52

I have a image button. I wanted to add a text \"Search\" on it. I am not able to add it because the \"imagebutton\" property in VS 2008 does not have text control in it. Can

相关标签:
9条回答
  • 2020-12-03 18:50

    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;
    

    }

    0 讨论(0)
  • 2020-12-03 18:53
    <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>
    
    0 讨论(0)
  • 2020-12-03 18:53

    I prefer the below solution:

                        <div style="padding: 5px; float: left;overflow: auto;height: auto;">
                            <asp:ImageButton ID="ImageButton2" ImageUrl="./icons/search24.png" ToolTip="Search"  runat="server" />
                            <p><asp:Label ID="Label7" runat="server" Text="Search"></asp:Label></p>
                        </div>
    

    You can change the style to make it center aligned, etc.

    0 讨论(0)
提交回复
热议问题