Click here to Skip to main content
16,013,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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???
Posted

1 solution

refer this code


CSS
 <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>


the .aspx page is

ASP.NET
<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>
 
Share this answer
 
v2
Comments
fjdiewornncalwe 27-Sep-12 13:41pm    
The answer is ok(3), but could be better if you cleaned up the code to only the parts relevant to the OP.
wings_ 28-Sep-12 1:01am    
ok thanks sir i will do it...

one again than u Marcus Kramer sir for giving me valuable suggestion

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900