如何使用css将背景图像应用于按钮 [英] How to apply background image to button using css
问题描述
在我的应用程序中我使用按钮。我想将背景图像应用于按钮即时编写代码,但它不显示背景图像到button.i不想使用图像按钮控件。
css文件
< pre lang =CSS>。按钮
{
background-image : url('/ img / button_2.png /');
}
源代码
< asp:按钮ID = Button1 runat = server CssClass = buttons Text = edit />
为什么不使用 ImageButton [ ^ ]控制?
使用其CssClass
属性表示你有如下按钮
。 myBtn
{
background : transparent url('myImage.png')no-repeat;
}
现在将此类应用于CssClass
属性中的按钮。
使用图像按钮 [ ^ ]控制而不是CSS。
此外,请参考:
在ASP.NET中设计选项卡的简单方法 [ ^ ]
本文将介绍如何使用Buttons,MultiView Control和CSS在ASP.NET页面中创建选项卡
在CSS类中尝试这样的事情
.buttons
{
background:url(images / orange_button_bg.gif)no-repeat 25%50%#FF8800;
}
In my application i m using button. i want to apply background image to button i m writing below code but it does not display background image to button.i dont want to use image button control.
css file
.buttons
{
background-image:url('/img/button_2.png/') ;
}
source code
<asp:Button ID="Button1" runat="server" CssClass="buttons" Text="edit" />
Why not use an ImageButton [^]control?
Use itsCssClass
property say you have button like following
.myBtn { background:transparent url('myImage.png') no-repeat; }
now apply this class in your button inCssClass
property.
Use Image Button[^] control instead of CSS.
In addition, please refer:
Simple way to Design Tabs in ASP.NET[^]
This article will show how to Create Tabs in ASP.NET page using Buttons, MultiView Control and CSS
Try something like this in your CSS class
.buttons { background: url(images/orange_button_bg.gif) no-repeat 25% 50% #FF8800; }
这篇关于如何使用css将背景图像应用于按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!