Asp.net 我怎样才能使按钮的背面透明

Asp.net 我怎样才能使按钮的背面透明,asp.net,css,Asp.net,Css,我正在尝试使用Css和asp.net中的以下代码创建一个玻璃按钮 我想让唯一的背景应该是透明的,但文本应该是可见的 鼠标悬停之前或之后 但我无法使按钮的背景透明。当我给optit值0时 整个按钮包括文本变得透明。但我只希望背景应该是透明的,文本应该是可见的 请帮帮我 我的Css代码: .classnameL { text-indent:1px; display:inline-block; font-family:Arial;

我正在尝试使用Css和asp.net中的以下代码创建一个玻璃按钮

我想让唯一的背景应该是透明的,但文本应该是可见的

鼠标悬停之前或之后

但我无法使按钮的背景透明。当我给optit值0时

整个按钮包括文本变得透明。但我只希望背景应该是透明的,文本应该是可见的

请帮帮我

我的Css代码:

.classnameL
 {

         text-indent:1px;
        display:inline-block;

        font-family:Arial;
        font-size:17px;
        font-weight:bold;
        font-style:normal;
         height:32px;
        line-height:50px;
        width:144px;
        padding 0px 0px 0px 0px;

        text-align:center;
        cursor: pointer;
        color:#ffffff;
        opacity:0;

   }
 .classnameL:hover 
 {
         background:-webkit-gradient( linear, left top, left bottom,color-stop(0.05,      #77d42a), color-stop(5, #5cb811) );
          background:-moz-linear-gradient( center top, #132354 60%, #c0C0C0 90% );
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a',endColorstr='#5cb      811');
         background-color:#5cb811;
         color:#ffffff;
         opacity:1;
  }
  .classnameL:active 
 { 
          position:relative;
          top:1px;
  }
我的Asp.net标记代码:

                                                     <td style="text-align: left"  >
              <asp:Button ID="btnTower" Text="Tower" runat="server"       class="classnameL"  
                       Font-Bold="False" Height="25px" Width="100%"       ForeColor="White"    ></asp:Button>
                                 </td>

您可以使用
背景色:透明CSS属性

.classnameL
  {
  ....
  background-color:transparent;
  }

您可以使用
背景色:透明CSS属性

.classnameL
  {
  ....
  background-color:transparent;
  }

如果我理解正确,您希望文本始终显示,并且当您悬停时背景变为透明。出于某种原因,你的文本标记不起作用,所以我去掉了它,并对你的许多代码和一些格式进行了快速重构

<td style="text-align: left">
<asp:Button ID="btnTower" runat="server" class="classnameL" Height="25px" Width="100%"/>Tower</asp:Button>
</td>

<style type="text/css">
  .classnameL {
    background: -webkit-gradient( linear, left top, left bottom,color-stop(0.05, #77d42a), color-stop(5, #5cb811)); 
    text-indent: 1px;
    display: inline-block;
    font-family: Arial;
    font-size: 17px;
    font-weight: bold;
    font-style: normal;
    height: 32px;
    line-height: 2em;
    width: 144px;
    text-align: center;
    cursor: pointer;
    color: #000;
  }
  .classnameL:hover {
    background: transparent;
   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a',endColorstr='#5cb811 ');
  }

  .classnameL:active { 
    position:relative;
    top:1px;
  }
</style>

塔楼
.classnameL{
背景:-webkit渐变(线性、左上、左下、颜色停止(0.05,#77d42a)、颜色停止(5,#5cb811));
文本缩进:1px;
显示:内联块;
字体系列:Arial;
字号:17px;
字体大小:粗体;
字体风格:普通;
高度:32px;
线高:2米;
宽度:144px;
文本对齐:居中;
光标:指针;
颜色:#000;
}
.classnameL:悬停{
背景:透明;
过滤器:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a',endColorstr='#5cb811');
}
.classnameL:活动{
位置:相对位置;
顶部:1px;
}

如果我理解正确,您希望文本始终显示,并且当您悬停时背景变透明。出于某种原因,你的文本标记不起作用,所以我去掉了它,并对你的许多代码和一些格式进行了快速重构

<td style="text-align: left">
<asp:Button ID="btnTower" runat="server" class="classnameL" Height="25px" Width="100%"/>Tower</asp:Button>
</td>

<style type="text/css">
  .classnameL {
    background: -webkit-gradient( linear, left top, left bottom,color-stop(0.05, #77d42a), color-stop(5, #5cb811)); 
    text-indent: 1px;
    display: inline-block;
    font-family: Arial;
    font-size: 17px;
    font-weight: bold;
    font-style: normal;
    height: 32px;
    line-height: 2em;
    width: 144px;
    text-align: center;
    cursor: pointer;
    color: #000;
  }
  .classnameL:hover {
    background: transparent;
   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a',endColorstr='#5cb811 ');
  }

  .classnameL:active { 
    position:relative;
    top:1px;
  }
</style>

塔楼
.classnameL{
背景:-webkit渐变(线性、左上、左下、颜色停止(0.05,#77d42a)、颜色停止(5,#5cb811));
文本缩进:1px;
显示:内联块;
字体系列:Arial;
字号:17px;
字体大小:粗体;
字体风格:普通;
高度:32px;
线高:2米;
宽度:144px;
文本对齐:居中;
光标:指针;
颜色:#000;
}
.classnameL:悬停{
背景:透明;
过滤器:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a',endColorstr='#5cb811');
}
.classnameL:活动{
位置:相对位置;
顶部:1px;
}

您只需在按钮标签中添加以下属性即可

style=“背景色:透明”

尝试用此替换您的asp代码

<td style="text-align: left">
<asp:Button ID="btnTower" Text="Tower" runat="server"class="classnameL"  
  Font-Bold="False" Height="25px" Width="100%" ForeColor="White"  style="background-color: Transparent">
</asp:Button>
</td>

您只需在按钮标签中添加以下属性即可

style=“背景色:透明”

尝试用此替换您的asp代码

<td style="text-align: left">
<asp:Button ID="btnTower" Text="Tower" runat="server"class="classnameL"  
  Font-Bold="False" Height="25px" Width="100%" ForeColor="White"  style="background-color: Transparent">
</asp:Button>
</td>