Is it legal to have children of an anchor tag in HTML? For an example:
<a>
<font>Example</font>
<img src="example.jpg"/>
</a>
It works fine in the browsers.But is it valid? Please help
Is it legal to have children of an anchor tag in HTML? For an example:
<a>
<font>Example</font>
<img src="example.jpg"/>
</a>
It works fine in the browsers.But is it valid? Please help
Yes - even more so with the advent of HTML 5 (From the spec):
Yes, all versions of HTML allow some elements inside an
a
element. The set of allowed elements depends on the HTML version. The code posted is valid HTML 3.2 and HTML 4.01 as far as element nesting goes, though theimg
element is not valid HTML 4.01 due to lack ofalt
attribute.