元素开始标签内的 HTML 注释

HTML Comments inside Opening Tag of the Element(元素开始标签内的 HTML 注释)

本文介绍了元素开始标签内的 HTML 注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试这个时

<option disabled = "disabled" <!-- Used to disable any particular option -->
        selected = "selected" <!-- Used to pre-select any particular option -->
        label = "string"      <!-- Used to provide a short version of the content in the option --> 
        value = "value">      <!-- The actual value that will be send to the server. If omitted the content between the option opening and closing tags will be send. -->

Option 1
</option>

我试图在元素的开始标签内注释属性和值.但是,这不起作用,因为浏览器(在 IE9、FF4.01、GG11、AF5 和 Opera11 上测试)将 disabled="disabled" 之后的所有内容视为评论或内容.

I am trying to comment the attributes and values inside the openning tag of the element. However this does not work as browsers (tested on IE9, FF4.01, GG11, AF5 and Opera11) treat everything followed after the disabled="disabled" as either comment or content.

HTMl Comments 是否不允许在元素的开始标签内?

Are HTMl Comments not allowed inside the opening tag of elements?

推荐答案

HTML 注释根本不允许在 inside 标签内,无论是开始还是结束.

HTML comments are not allowed inside tags, start or end, at all.

这篇关于元素开始标签内的 HTML 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:元素开始标签内的 HTML 注释

基础教程推荐