当前位置:编程学习 > C#/ASP.NET >>

如何在asp:botton中添加图标

就是这个样子 如何弄的 代码 如下:
 <div class="bottc"><asp:Button ID="Bt_ExportExecl" runat="server" onclick="Bt_ExportExecl_Click" Text="导出Excel" style=" text-align:right; padding-right:13px;" CssClass="regularss" /><!--导出Execl--></div> --------------------编程问答-------------------- 就跟 cn网站上面的回复按钮类似 --------------------编程问答-------------------- 加个css样式就OK了 --------------------编程问答--------------------
设置背景图?



 <asp:Button ID="Button1" runat="server" Text="Button" style="background-image:url('XXX.jpg')" />

--------------------编程问答-------------------- 用css添加应该是可以的 --------------------编程问答-------------------- cssclass啊?怎么会div.. --------------------编程问答-------------------- 因为我做的 是 样式是完全透明的  所以加 背景图 没有效果。。 --------------------编程问答--------------------
那你得把你的样式bottc、regularss贴出来。。。

要不然不知道你写的什么样式。。。 --------------------编程问答-------------------- .bottc a, .bottc input{display:block;float:left;margin:0 0 0 0; background-color:transparent; border:0;font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;  font-size:12px; line-height:130%;text-decoration:none; font-weight:500; color:#000;    cursor:pointer; padding:0;}
.bottc a.regularss:hover, input.regularss:hover{background-color:#dff4ff; border:0; color:#000; }
.bottc a.regularss:active{background-color:#6299c5;   border:0; color:#fff;background:url(../images/fgfg.png) repeat-X ;} /* Links */
.bottc input{ width:auto;  overflow:visible; padding:0 3px 2px 3px; /* IE6 */}
.bottc input[type]{ margin-top:2px;    padding:3px 1px 2px 3px; /* Firefox */  line-height:17px;}
*:first-child+html input[type]{  padding:0 3px 2px 3px; /* IE7 */}
.buttc input img, .bottc a img{  border-style: none; border-color: inherit; border-width: medium; margin: 0; padding: 0;
width:16px; height:16px; text-align:center; float:left;}
input.regularss, .bottc a.regularss{color:#000; width:100px;}/*小于4个字节调用此样式*/
.bottc a.regularss:hover, input.regularss:hover{background:url(../images/botton.gif); border:1px solid #c2e1ef; color:#000;}
.bottc a.regularss:active{ background-color:transparent;   border:1px solid #6299c5; color:transparent;} 按钮的样式 
#menu{
border-right: #bbdde5 1px solid; padding-right: 1px; border-top: #bbdde5 1px solid;
padding-left: 1px; background: #f4fafb; padding-bottom: 1px; margin: 0px 0px 5px;  margin-bottom:1px;
border-left: #bbdde5 1px solid; color: #9cacaf; padding-top: 1px; border-bottom: #bbdde5 1px solid;

} menu样式 --------------------编程问答--------------------
.bottc a, .bottc input{display:block;float:left;margin:0 0 0 0; background-color:transparent; border:0;font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif; font-size:12px; line-height:130%;text-decoration:none; font-weight:500; color:#000; cursor:pointer; padding:0;}
.bottc a.regularss:hover, input.regularss:hover{background-color:#dff4ff; border:0; color:#000; }
.bottc a.regularss:active{background-color:#6299c5; border:0; color:#fff;background:url(../images/fgfg.png) repeat-X ;} /* Links */
.bottc input{ width:auto; overflow:visible; padding:0 3px 2px 3px; /* IE6 */}
.bottc input[type]{ margin-top:2px; padding:3px 1px 2px 3px; /* Firefox */ line-height:17px;}
*:first-child+html input[type]{ padding:0 3px 2px 3px; /* IE7 */}
.buttc input img, .bottc a img{ border-style: none; border-color: inherit; border-width: medium; margin: 0; padding: 0;
width:16px; height:16px; text-align:center; float:left;}
input.regularss, .bottc a.regularss{color:#000; width:100px;}/*小于4个字节调用此样式*/
.bottc a.regularss:hover, input.regularss:hover{background:url(../images/botton.gif); border:1px solid #c2e1ef; color:#000;}
.bottc a.regularss:active{ background-color:transparent; border:1px solid #6299c5; color:transparent;} 按钮的样式  
#menu{
border-right: #bbdde5 1px solid; padding-right: 1px; border-top: #bbdde5 1px solid;
padding-left: 1px; background: #f4fafb; padding-bottom: 1px; margin: 0px 0px 5px; margin-bottom:1px;
border-left: #bbdde5 1px solid; color: #9cacaf; padding-top: 1px; border-bottom: #bbdde5 1px solid;

} menu样式
--------------------编程问答--------------------
引用 3 楼 porschev 的回复:
设置背景图?


C# code


 <asp:Button ID="Button1" runat="server" Text="Button" style="background-image:url('XXX.jpg')" />

+1
--------------------编程问答-------------------- 爲什麽不用imagebutton呢 --------------------编程问答--------------------
引用 11 楼 qingcongcuizu 的回复:
爲什麽不用imagebutton呢

+1
变通下 --------------------编程问答-------------------- 怎么不用imagebutton --------------------编程问答-------------------- 有ImgButton这种利器啊 --------------------编程问答-------------------- ImgButton --------------------编程问答--------------------

<style type="text/css">
.img{style="background-image:url('XXX.jpg')" }
</style>

<asp:Button ID="Button1" runat="server" Text="Button" cssClass="img" />


引用 3 楼 porschev 的回复:
设置背景图?


C# code


 <asp:Button ID="Button1" runat="server" Text="Button" style="background-image:url('XXX.jpg')" />
--------------------编程问答-------------------- 实在不行用imagebutton --------------------编程问答-------------------- 用css样式给Button添加背景图片 --------------------编程问答-------------------- imagebutton
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,