通过css为图像按钮应用图像 [英] apply image through css for image button
本文介绍了通过css为图像按钮应用图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何通过CSS为ImageButton控件应用图像.我试过了,但是它显示的是图像以及在图像上命名为"SubmitQuery"的文本.有人可以帮我吗?
I would like to know how to apply image for ImageButton control through CSS. I tried , but it is showing image along with a text naming "SubmitQuery" on the image. Can anyone help me out???
推荐答案
请参阅此代码
refer this code
<style type="text/css">
.aerobuttonmenu
{ /*container that holds a row of aero buttons*/
overflow: hidden;
width: auto;
background: #F7F7F7; /*menu strip background*/
border: 1px solid gray;
padding: 4px 0;
border-width: 1px 0;
}
* html .aerobuttonmenu{ /*IE6 and below hack. Set explicit strip width*/
width: 100%;
}
.aerobuttonmenu a.aero{ /*aero button CSS*/
background: url('Images/aeroleft.gif') no-repeat left top;
display: block;
float: left;
/* Change 13px as desired */
line-height: 23px; /* This value + 8px should equal height of button background (default is 31px) */
height: 39px; /* Height of button background height */
padding-left: 10px; /* Width of left menu image */
text-decoration: none;
margin-right: 5px; /*spacing between buttons*/
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90); /*this and next two rules control opacity of buttons before hover*/
opacity: 0.9;
-moz-opacity: 0.9;
font-style: normal;
font-variant: normal;
font-weight: bold;
font-size: 13px;
font-family: Verdana, "Trebuchet MS";
}
.aerobuttonmenu a.aero:link, .aerobuttonmenu a.aero:visited, .aerobuttonmenu a:active{
color: white;
width: 149px;
}
.aerobuttonmenu a.aero span
{
background: transparent url('Images/aeroright.gif') no-repeat top right;
display: block;
padding: 4px 10px 6px 0; /*Set 10px here to match value of 'padding-left' value above*/
}
.aerobuttonmenu a.aero:hover
{ /* Hover state CSS */
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100); /*this and next two rules control opacity of buttons during hover*/
opacity: 1;
-moz-opacity: 0.99;
}
.aerobuttonmenu a.aero:hover span{ /* Hover state CSS (for text) */
color: yellow;
}
.black a.aero{
background-image: url('Images/aeroleftblack.gif');
}
.black a.aero span
{
background-image: url('Images/aerorightblack.gif');
}
.aerobuttonmenu .rightsection
{
float: right;
width: 100px;
position: relative;
top: 3px;
padding-right: 5px;
text-align: right;
}
.aerobuttonmenu .rightsection a
{
color: navy;
}
#form1
{
height: 57px;
width: 999px;
}
#mydiv
{
background-color:grey;
height: 100px;
width: 100px;
display:none;
}
</style>
.aspx页面是
the .aspx page is
<body>
<form id="form1" runat="server">
<div class="aerobuttonmenu black" align="center">
<a href="upload.aspx" class="aero"><span>Home</span></a>
<a href="http://tools.dynamicdrive.com" class="aero"><span>Master</span></a>
</div>
</form>
</body>
这篇关于通过css为图像按钮应用图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文