2014-06-14 54 views
0

我想知道如果有人知道如何在不影響文本鏈接(導航)的情況下移除鏈接圖像的背景顏色?如何從圖像中刪除鏈接背景顏色但不是文字

這裏是CSS我對導航:

a:link,a:visited { 
    margin: 0 auto; 
    display: block; 
    font-weight: 400; 
    color: #000000; 
    display: block; 
    width: 120px; 
    background-color: #FF9001; 
    text-align: center; 
    padding: 10px; 
    text-decoration: none; 
    text-transform: uppercase; 
    font-family: bangers; 
    font-style: normal; 
    font-size: large; 
    letter-spacing: 2px; 
    word-spacing: 2px; 
} 
a:hover,a:active { 
    background-color: #DC5D06; 
} 
li { 
display:inline-block; 
} 

,這裏是我有問題的HTML:

<header id="Top"> 
    <table width="1294" border="0"> 
     <tr> 
      <td width="351"><a href="index.html"><img src="Img_folder/Dons new logo.png" width="351" height="203" alt="Dons Remote Control Toys Logo"/></a></td> 
      <td width="919"><h1>Dons <span class="highlight">Remote Control Toys</span></h1></td> 
     </tr> 
    </table> 
    <div id="tagline"> 
     <h4>If we dont have it, then it probably doesn't exist</h4> 
    </div> 
    <nav id="mainnav"> 
     <ul> 
     <li><a href="index.html">Home</a></li> 
     <li><a href="land_toys.html">Land Toys</a></li> 
     <li><a href="air_toys.html">Air Toys</a></li> 
     <li><a href="water_toys.html">Water Toys</a></li> 
     <li><a href="contact_us.html">Contact Us</a></li> 
     </ul> 
    </nav> 
    </header> 

@Quentin,@大衛托馬斯我仍然無法得到這個工作,不知道如何

回答

-1

你可以用CSS做:

a img { 
properties here 
} 

樣品:

a img{ 
    background: none; 
} 

這將從A(錨)標籤內嵌套的圖像刪除所有的背景或更改你需要財產。

祝你好運,希望這可以幫助你

+0

似乎沒有工作。可能是由於我不知道在哪裏插入正確的CSS。我剛纔看到這個,但不能理解它,這可能有用嗎? a.no-bg,a.no-bg:link,a.no-bg:active,a.no-bg:hover,a.no-bg:active { background:none; } – kungfool

+0

你可能不得不使用「background-color:none;」,上面的示例會工作..你可以發佈一個JSFIDLE鏈接,以便我們可以看到發生了什麼事情..我假設你有圖像上的填充,所以背景可見的是這種情況? – Ljubisa

+0

圖像上根本沒有填充,但在:鏈接上填充了a:visited。我將研究JSFIDLE是什麼。從未使用過或聽說過很多 – kungfool