简体   繁体   中英

Placing anchor element inside an anchor element

I was wondering if HTML code is valid:

<a href="www.example.com" target="_blank">
   <a href="www.other.com" target=_blank">OTHER</a>
   <div>Example</div>
</a>

What other can it be done if it's not valid?

No, this code is not valid. Links fall into the category of "interactive content," and cannot (per the specification) contain any elements that are also within the category of "interactive content".

Source: http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM