給a標(biāo)簽加上的背景圖片在給a標(biāo)簽設(shè)置hover在動(dòng)到a標(biāo)簽區(qū)域時(shí)背景圖片被隱藏的問題。?
<!doctype html> <html lang="en"><head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus?"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>Document</title> <style> *{margin:0; padding:0;} body{font-size:14px;} ul{list-style:none;} .dh{width:953px; height:38px; border:1px solid green; border-top:1px solid #ccc; margin:150px auto 0;} .dh li{float:left; width:105px; line-height:38px; text-align:center; border-right:1px dotted red;} .dh li a{text-decoration:none; display:block; color:#333; background: url(360.png) no-repeat 10px 10px;} .dh li a:hover{background:#ccc;} li.abc{border-right:none;} </style></head><body> <div class="dh"> <ul> <li class="item1"><a href="#">推薦網(wǎng)站</a></li> <li cla<愛尬聊_百科知識(shí)大全>ss="item2"><a href="#">新聞?lì)^條</a></li> <li class="item3"><a href="#">電 視 劇</a></li> <li class="item4"><a href="#">最新電影</a></li> <li class="item5"><a href="#">小 游 戲</a></li> <li class="item6"><a href="#">小說大全</a></li> <li class="item7"><a href="#">旅游度假</a></li> <li class="item8"><a href="#">網(wǎng)上購物</a></li> <li class="abc"><a href="#">好藥特惠</a></li> </ul> </div></body> </html>
干拉白給 16小時(shí)前
a:hover把你原先的background圖片覆蓋了,你應(yīng)該用li:hover。至于后面那個(gè)間隙問題應(yīng)該是瀏覽器的兼容問題,你把父元素dh的寬度去掉讓它自適應(yīng)就可以了。
丑和讀書有啥關(guān)系 16小時(shí)前
hover 了之后,標(biāo)簽a就有了兩個(gè)background 數(shù)據(jù),根據(jù)優(yōu)先級(jí),它會(huì)選擇:hover下的background。簡(jiǎn)單說:背景不是被覆蓋,而是被換掉了。