【问题标题】:How to wrap multi-line comments in another comment in CSS? [duplicate]如何在 CSS 的另一条评论中包装多行评论? [复制]
【发布时间】:2015-09-04 10:19:52
【问题描述】:

在css中,我可以做这样的cmets

/* 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;
    }
*/

有人知道怎么做吗?

谢谢。

【问题讨论】:

    标签: css comments


    【解决方案1】:
    /* test3 */
    

    应该只是

    /* test3
    

    保持打开状态直到最后一个*/

    【讨论】:

    • 但是如果我不做外部评论包装,test3 的开头评论会使其余的 css 被评论。我正在寻找嵌套 cmets。
    • 如果你想评论 test3/h2 块,它应该是这样的: /* test / p { color: red; } / /* test2 / h1 { color: red; } / test3 h2 { 颜色:红色; } */
    【解决方案2】:

    把你不需要的都说出来

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

    【讨论】:

    • 这不是我要问的。我在问如何将 cmets 嵌套在其他 cmets 中。
    • /* 测试 / p { color: red; } /------------comment start /* test2 /---- comment end h1 { color: red; } / test3 */ h2 { color: red; } */ 这就是为什么不工作你必须删除结束 cmets
    【解决方案3】:

    要在 CSS 中注释多行,请不要关闭您的

    /*
    

    你可以有这样的东西:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 2011-01-08
      • 1970-01-01
      • 2018-12-15
      • 2014-10-26
      • 1970-01-01
      相关资源
      最近更新 更多