HI
i have used tag's a to link a address. i've used it like this :

<a ... > <img ... /><br /> <h1> example </h1></a>

when i've validate it , this error has been showed .

is there any problwm if i've used tag's a like this .

thanks

Recommended Answers

All 2 Replies

The anchor element is an inline element. Inline element can't contain block level element. You put h1 tag in anchor tag. It makes the browser confuse. You should write like that:

<h1>Example<a href="#"><img src="image.gif" /></a></h1>
<h1><a href="#"><img src="image.gif" /></a>Example</h1>
<h1><a href="#"><img src="image.gif" /></a><br />Example</h1>

The block element can contain inline and other block level element.

<div><!-- The div is block element -->
        <h1>This is block element heading</h1>
</div>
<!-- This is available -->

<span><!-- The span is inline element -->
         <h1>This is block element heading</h1>
</span>
<!-- This one is unavailable -->

I hope this will help you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.