Reputation: 1160
My source code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it" lang="it">
<head>
<title>Hi</title>
</head>
<body>
<div id="content">
<a href="product_displayer.cgi">
<div style="background-image: url('../res/images/background.jpeg')">
<img src="../res/images/products/thumbnails/image.png" alt="hello"/>
<p>Hello hello hello</p>
</div>
</a>
</div>
</body>
</html>
If I try to validate the code, the W3C validator giving me this error:
document type does not allow element "div" here; missing one of "object", "ins", "del", "map", "button" start-tag
How can I solve it?
Upvotes: 0
Views: 556
Reputation: 943537
<a href="product_displayer.cgi"> <div style="background-image: url('../res/images/background.jpeg')">
In XHTML 1, you cannot have a div inside an anchor.
Either don't use a div (or a paragraph) or use HTML 5 which does allow that.
Upvotes: 2