css伪类,规则失效css格式化 http://www.jb51.net/tools/cssyasuo.shtml 格式化后会多出个空格,多出空格后样式规则失效了。
<!DOCTYPE html> <html> <head> <title>书写css伪类时冒号后多个空格导致该规则失效</title> <meta http-equiv="Content-Type" content="text/html;charset=gbk"/> <style type="text/css"> a:link{color : gray;} a:visited{color : red;} /* 冒号后多了个空格 */ a: hover{color : yellow;} </style> </head> <body> <a href="http://www.sina.com">sina</a> </body> </html>
推荐使用工具YUI Compressor 、Closure Compiler Google出品的JavaScript优化器或者 CSSTidy等离线工具,直接在线操作不仅可压缩js也可以压缩css。 css伪类,规则失效
|