html5中的嵌套锚文本(nested anchor texts in html5)
我知道HTML 4( 规范 )中不允许嵌套锚标签。 关于HTML 5我不太确定:
只要在其中没有交互式内容(例如按钮或其他链接),a元素可以围绕整个段落,列表,表格等,甚至整个部分。
我知道没有href属性的元素不是链接。 嵌套锚是否有效,如果内部锚没有href属性?
I know that nesting of anchor tags is not allowed in HTML 4 (spec). I am not so sure however about HTML 5:
The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).
I understand that an element without an href attribute is not a link. So are nested anchors valid if the inner ones are fo not have href attributes?
原文:https://stackoverflow.com/questions/21600897
更新时间:2020-01-27 20:53
最满意答案
交互式内容是专门用于用户交互的内容。
音频(如果存在控件属性)按钮详细信息嵌入iframe img(如果存在usemap属性)输入(如果type属性不处于隐藏状态)keygen标签对象(如果存在usemap属性)选择textarea视频(如果存在controls属性)
您会注意到其中一些元素有条件。 a元素没有。 (即它表示“a”不是“a(如果href属性存在)”。
因此,根本无法嵌套元素。
Interactive content is content that is specifically intended for user interaction.
a audio (if the controls attribute is present) button details embed iframe img (if the usemap attribute is present) input (if the type attribute is not in the hidden state) keygen label object (if the usemap attribute is present) select textarea video (if the controls attribute is present)
You will note that some of those elements have conditions. The a element does not. (i.e. it says "a" not "a (if the href attribute is present)".
So it is not valid to nest a elements at all.
相关问答
只用HTML5和JS,CSS写的游戏(2048,围住神经猫,flappy bird),之前火过一段时间,现在还好,有发展前景,但是只适合轻中度游戏,不能做大型重度游戏
您可以根据需要以编程方式更改dir属性来控制每个字符串的方向: var text = 'קצת text בעברית'
var canvas = document.getElementById('canvas')
var ctx = canvas.getContext('2d')
ctx.font = '24px Arial'
ctx.fillText(text, 165, 50)
canvas.setAttribute('dir','ltr');
ctx.fillText(
...
不允许嵌套元素 : 内容模型: 透明,但必须没有交互式内容后代。 交互式内容是“专门用于用户交互的内容”。 例如, button , input , audio ...... It is not allowed to nest a elements: Content model: Transparent, but there must be no interactive content descendant. Interactive content is "content that is spec
...
一个问题是你在使用Prototype之前尝试使用Prototype。 将js/prototype.js的脚本标记移动到js/drop-o-matic.js脚本标记js/drop-o-matic.js 。 如果您使用调试器(Chrome的Dev Tools,Firebug for Firefox,Script Debugger for IE,......),它应该告诉您。 在这种情况下,例如,Chrome的开发工具向我展示了Uncaught TypeError: Object #
...
我99.9%肯定这不是一件事,对不起。 浏览器搜索发生在HTML /渲染世界之外。 I'm 99.9% sure that's not a thing, sorry. Browser searching occurs outside of the HTML/rendering world.
你需要使用 $(this).data('x')
在回调方法内部, this引用了dom对象,但.data()方法在元素的jQuery对象封装器中定义。 所以你需要用$(this)用jQuery来包装dom元素。 You need to use $(this).data('x')
Inside the callback method, this references the dom object, but the .data() method is defined in the jQuery o
...
交互式内容定义为: 交互式内容是专门用于用户交互的内容。 音频(如果存在控件属性)按钮详细信息嵌入iframe img(如果存在usemap属性)输入(如果type属性不处于隐藏状态)keygen标签对象(如果存在usemap属性)选择textarea视频(如果存在controls属性) 您会注意到其中一些元素有条件。 a元素没有。 (即它表示“a”不是“a(如果href属性存在)”。 因此,根本无法嵌套元素。 Interactive content is defined as: Interact
...
对的,这是可能的: sms:12345678?body=TEXT
其中12345678是电话号码 Yes, it is possible: sms:12345678?body=TEXT
where 12345678 is the phone number
以及在不使用javascript的情况下实现此目的的唯一可行方法是 Footer
....some html...
some footer text
well the only possible way to achieve this without the use of javascript is Footer
...
是的,这在HTML5中完全有效。 3.2.3.1 id属性 id属性指定其元素的唯一标识符(ID) 。 [DOM] 该值必须在元素的主子树中的所有ID中唯一,并且必须至少包含一个字符。 该值不得包含任何空格字符 。 注意: ID可以采用何种形式没有其他限制; 特别是, ID可以只包含数字,以数字开头,以下划线开头,仅包括标点符号等。 http://www.w3.org/TR/html5/dom.html#the-id-attribute (强调添加) Yes, this is perfectly
...