Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
644 views
in Technique[技术] by (71.8m points)

html - Is it ok to have an `<a>` inside another `<a>`?

If I had a link to another page, and another link was put inside it, would that be ok to do? Is it allowed in HTML5 and if so, which browsers support it?

Trying this in Chrome 14.0.835.202, I see the text on the left gets linked, followed by the #1 link, but the rest doesn't get linked.

Example:

<p>
 <a href="download?file=2">Example file.txt</a>
 [
  <a href="revision?file=2&id=8">This is an example revision that fixes bug 
   <a href="bug?file=2&id=1">#1</a>. 
   Version number updated.
  </a>
 ]
</p>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

According to the W3C specification for links HTML5: No.

Content model:
Transparent, but there must be no interactive content descendant.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...