Question

I am wanting to make my code compliant,

<!DOCTYPE html>

I am using something like this,

<a href='#'>
    <div> Stuff </div>
</a>

But it is clear that compliance wants something more like,

<div> 
    <a href='#'> Stuff </a>
</div>

Is there a way to implement the above code in a compliant way?

When i mean 'Stuff' i mean other divs or text.

My code works without the specification of doctype, but once I do weird things happen.

Was it helpful?

Solution

According to the W3C a div may not live inside an a element, unless you're declaring the doctype as HTML5. HTML5 allows a elements to contain blocks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top