You control design and styles with CSS, not the behavior of your content.
You're going to have to use something like <a id="header" href="[your link]">Logo</a>
and then have a CSS block such as:
a#header {
background-image: url(...);
display: block;
width: ..;
height: ...;
}
You cannot nest a div
inside <a>
and still have 'valid' code. <a>
is an inline element that cannot legally contain a block element. The only non-Javascript way to make a link is with the <a>
element.
You can nest your <a>
tag inside <div>
and then put your image inside :)
If you don't want that, you're going to have to use JavaScript to make your <div>
clickable:
Document.getElementById("header").onclick = function() {
window.location='...';
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…