次のようなHTMLのブロックがあります。
<div id="header">
<h1>title</h1>
<h2>subtitle</h2>
</div>
私はCSS手法を使用して、すべてのテキストを非表示にし、画像に置き換えています。しかし、ブロック全体をホームページにリンクしたいと思います。<a>
標準に準拠していないため、ラップすることはできません。では、どうすればよいですか?
私の解決策; 町の新人に触発された
<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;
}