相信多数开发者不会多个空格。
偶然发现的,网上多数css格式化将压缩后的css格式化后会发生这个情况。
搜“css格式化”,以下网站
softbar
http://www.softbar.com/
格式化后会多出个空格,多出空格后样式规则失效了。
01
<!DOCTYPE html>
02
<html>
03
<head>
04
<meta charset="utf-8">
05
<title>书写css伪类时冒号前或后多个空格导致该规则失效</title>
06
<style type="text/css">
07
a:link {
08
color: gray;
09
}
10
a:visited {
11
color: red;
12
}
13
/* 冒号后多了个空格 */
14
a: hover {
15
color: yellow;
16
}
17
</style>
18
</head>
19
<body>
20
<a href="http://www.sina.com.cn">sina</a>
21
</body>
22
</html>
所有浏览器中测试hover规则没起作用。
在冒号前多了个空格也一样。
须注意..