0
我有HTML塊,看起來像這樣:如何以符合標準的方式鏈接標題?
<div id="header">
<h1>title</h1>
<h2>subtitle</h2>
</div>
我使用一個CSS技術來隱藏所有文字和用圖像替換它。但我想將整個區塊鏈接到主頁。我不能將它包裝在<a>
中,因爲這不符合標準。那我該怎麼做呢?
我的解決方案;通過New in town
<div id="header">
<h1>title</h1>
<h2>subtitle</h2>
<a href="index.html">Home</a>
</div>
#header {
text-indent: -9999px;
width: 384px;
height: 76px;
background: transparent url(../images/header.png) no-repeat;
margin: 10px;
position: relative;
}
#header a {
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
我猜這個主意很好,但我認爲你的語義是錯誤的。 ''標籤中應該有文字,如果您也在標頭中投擲'',則可能更容易處理。 – mpen 2009-09-19 23:01:47