如何通过CSS为ASP.NET中的linkbutton控件设置图像和文本? [英] How to set both image and text for linkbutton control in ASP.NET through CSS ?
本文介绍了如何通过CSS为ASP.NET中的linkbutton控件设置图像和文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I want linkbutton control in asp.net to have both icon and text for login, add update delete etc (.png or .gif) with it.
I have googled and find some posts saying its possible through css with following code:
.clslnkbutton {
background: url(../images/icons/login.png) no-repeat left top;
display:inline;
padding-left:18px;
margin-left: 10px;
padding-right:10px;
}
<asp:LinkButton ID="LinkButton1" CssClass="clslnkbutton" runat="server">Login</asp:LinkButton>
But, after trying above code still its not displaying image.
Please suggest some solution.
我尝试过:
What I have tried:
<asp:LinkButton ID="LinkButton1" CssClass="clslnkbutton" runat="server">Login</asp:LinkButton>
.clslnkbutton {
background: url(../images/icons/login.png) no-repeat left top;
display:inline;
padding-left:18px;
margin-left: 10px;
padding-right:10px;
}
推荐答案
试试这个
try this
.clslnkbutton {
padding:5px;
padding-left:25px;
border:1px solid red;
background-image: url(./Images/save.png);
background-position: 2px;
background-repeat: no-repeat;
}
这篇关于如何通过CSS为ASP.NET中的linkbutton控件设置图像和文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文