Skip to content

[html] 第172天 HTML的注释有几种写法?有什么规范吗? #1296

Open
@haizhilin2013

Description

@haizhilin2013

第172天 HTML的注释有几种写法?有什么规范吗?

Activity

notbucai

notbucai commented on Oct 4, 2019

@notbucai

应该算两种吧

haizhilin2013

haizhilin2013 commented on Oct 4, 2019

@haizhilin2013
CollaboratorAuthor

应该算两种吧

写注释有哪些规范呢?

notbucai

notbucai commented on Oct 4, 2019

@notbucai
<!-- 这是一段注释 -->
<!--[if IE 8]>
    .... some HTML here ....
<![endif]-->
zhaofeipeter

zhaofeipeter commented on Jul 30, 2020

@zhaofeipeter

必须以4个有序字符开始:编码为 U+003C LESS-THAN SIGN 的小于号, 编码为 U+0021 EXCLAMATION MARK 的感叹号, 编码为 U+002D HYPHEN-MINUS 横线, 编码为 U+002D HYPHEN-MINUS横线 ,即 “<!—”
在此之后是注释内容,注释的内容有以下限制:
不能以单个 “>” (U+003E) 字符开始
不能以由 “-“(U+002D HYPHEN-MINUS)和 ”>” (U+003E) 组合的字符开始,即 “->”
不能包含两个连续的 U+002D HYPHEN-MINUS 字符,即 “—”
不能以一个 U+002D HYPHEN-MINUS 字符结束,即 “-”
必须以3个有序字符结束:U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN,即 “—>”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@zhaofeipeter@notbucai

        Issue actions

          [html] 第172天 HTML的注释有几种写法?有什么规范吗? · Issue #1296 · haizlin/fe-interview