元素开始标签内的 HTML 注释

2022-01-18 00:00:00 comments tags 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.

相关文章