2013-11-20 39 views
1

我試圖創建一個使用下面的CSS代碼和asp.net我怎樣才能使按鍵爲透明

我想要做的只是回地面應該是透明的一塊玻璃按鈕,但文本應該是隻回地面可見

之前或之後,鼠標移到

,但我不能做回地面按鈕的透明。當我給opcitt值0

整個按鈕包括文字變得透明。但我只想要回地面應該b Ë透明和文字應清晰可見..

請幫我

我的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> 

回答

4

可以使用background-color:transparent; CSS屬性

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

如果我的理解正確,您希望文本始終顯示,並且當您懸停時背景變得透明。出於某種原因,你的文字標記無法工作,所以我擺脫它,我做了很多你的代碼和一些格式化的快速重構

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

你只需要添加下面的屬性,在按鈕標籤

style="background-color: Transparent"

嘗試用這種

<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> 
更換你的ASP代碼