如何在CSS中的另一条评论中包含多行注释?

时间:2015-06-18 16:39:02

标签: css comments

在css中,我可以做这样的评论

/* test */
p {
    color: red;
}
/* test2 */
h1 {
    color: red;
}
/* test3 */
h2 {
    color: red;
}

但现在如果我想对test2和test3发表评论怎么办?这不起作用。

/* test */
p {
    color: red;
}
/*
    /* test2 */
    h1 {
        color: red;
    }
    /* test3 */
    h2 {
        color: red;
    }
*/

有谁知道怎么做?

感谢。

4 个答案:

答案 0 :(得分:0)

/* test3 */

应该只是

/* test3

将其保持打开状态,直到最后*/

答案 1 :(得分:0)

要在CSS中注释多行,只需不要关闭

/*

你可以有类似的东西:

/* test 
p {
color: red;
}
 test2
h1 {
color: red;
}
*/

/* test3 */
h2 {
color: red;
}

答案 2 :(得分:0)

这个问题已经回答:CSS Nested Comments(css不支持嵌套,你必须使用黑客或预处理器)

答案 3 :(得分:-1)

扼杀所有你不需要的东西



/*
line1
Line2
line3
 */
 Line 4
line5
/*again*/




相关问题