0
可能重複:
How to make a whole 'div' clickable in html and css without javascript?背景鏈接(在所有的背景!)
我已經建立了一個100%的寬度/高度格留在網站上的背景,像這樣:
.background {
background-color:rgba(50,50,50,0.4);
width:100%;
height:100%;
position:absolute;
z-index:-1;
}
我想有一個可以覆蓋整個DIV的鏈接,但如果我的代碼是這樣的,我會哈讓鏈接只出現在div的最後部分(請記住,這個div必須保持在後臺,其上有一些div),在其他div之後,保持在它之上。
<a href='/home'>
<div class='background'></div>
</a>
是否有任何HTML/CSS解決方案?
https://www.google.com/search?q=LINK+DIV – 2012-07-18 16:07:44
只需使用一個A標記設置爲顯示具有相同位置,寬度和高度值的BLOCK而不是DIV。 – 2012-07-18 16:09:35