Do double forward slashes direct IE to use specific css?

丶灬走出姿态 提交于 2019-11-28 02:04:10
thirtydot

// is not a valid CSS comment.

Browsers that parse CSS properly will ignore //position because //position is not a valid property name (details are here, property -> IDENT S* -> follow it through).

This only works in IE7 due to its well known bug of accepting properties with junk prepended to them.

It's not just // that works. IE7 will have red text here:

body {
    !/!*//color: red;
}

This is most typically exploited with *, for example *display: inline; as part of the display: inline-block workaround for IE7.

Dario Corno

Don't fall into the temptation of commenting out single lines or blocks and not using the correct /* */ couple. A customer who has access to the website folder just chose by himself to comment out a single line using this:

//*  comment here   *//

Actually, Chrome and Safari will ignore ANYTHING that follows this line. I would call it a "css killer". :D

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!