HTML - 评论后的行

BcK*_*BcK 2 html css

<head>
    <style type="text/css">
        <!-- comment -->
        h2 {color:#34DE56;}
        p  {text-indent:25px;}
    </style>
</head>
Run Code Online (Sandbox Code Playgroud)
<head>
    <style type="text/css">
        h2 {color:#34DE56;}
        p  {text-indent:25px;}
    </style>
</head>
Run Code Online (Sandbox Code Playgroud)

嘿大家我知道这可能是关于HTML的最基本的问题,但我找不到它背后的原因.

上面的代码包含注释.当我在任何行之前放置此注释时,以下行不会被读取.其余的工作正常.

基本上,当我在前一行中添加注释时,着色部分不起作用.当我删除评论时,它按照预期的方式工作.

小智 6

对于CSS使用:

/* Comment */
Run Code Online (Sandbox Code Playgroud)

对于html使用:

<!-- Comment -->
Run Code Online (Sandbox Code Playgroud)