CSS嵌套注释其他注释中的多行代码注释

CSS嵌套注释其他注释中的多行代码注释,css,Css,在CSS文件中,我有两种格式化body元素的方法。 如何注释以选择主体样式1 /* body style 1 */ body { background-color: #E6F6F6; /* color 1 */ } /* I want to comment all from here to end */ /* /* body style 2 */ body { background-color: #F6F6F6; /* color 2 */ } /* this right bracke

在CSS文件中,我有两种格式化body元素的方法。 如何注释以选择主体样式1

/* body style 1 */
body {
  background-color: #E6F6F6; /* color 1 */
}

/* I want to comment all from here to end */
/*
/* body style 2 */
body {
  background-color: #F6F6F6; /* color 2 */
} /* this right bracket is not commented out */
p {
    font-size: 10px;
}
*/

CSS注释一直运行到第一个*/实例。不能嵌套CSS注释

你可以做这样的事情,但很麻烦:

/* body style 1 */
body {
  background-color: #E6F6F6; /* color 1 */
}

/* I want to comment all from here to end */
/*
/* body style 2 */
/*body {
  background-color: #F6F6F6; /* color 2 */
/* } /* this right bracket is not commented out */
p {
    font-size: 10px;
}
*/

删除
/*color 2*/
注释和其他注释,然后它就可以工作了

/* body style 1 */
body {
  background-color: #E6F6F6; 
}

/* I want to comment all from here to end */

/* body style 2 */
/*
body {
  background-color: #F6F6F6; 
} 
p {
    font-size: 10px;
}
*/

@ColinD我想在开发过程中尝试比较不同的格式样式。所以我必须保留不同的CSS文件和复制粘贴吗?我会的,是的。我还发现Chrome开发工具在进行动态样式更改时非常有用。