---
title: "用Holmes.css进行有效性和可访问性测试"
author: "liuming"
date: "2011-04-30T14:11:55Z"
tags: ["CSS", "Chrome", "Firefox", "Safari", "浏览器"]
categories: ["Web前端"]
slug: "holmes-css"
draft: false
lastmod: "2011-04-30T14:11:55Z"
id: 1025466
url: "https://liuming.iteye.com/blog/1025466"
---

[Holmes.css](http://www.red-root.com/sandbox/holmes/ "holmes") 一组用来测试页面的有效性和可访问性的神奇CSS。启用之后，它会用红色框来标示出错或无效的元素，用黄色框标示可能有问题的元素，用灰色柜标示已经从HTML标准中删除的元素。如图所示：

![holmes.css](/upload/picture/pic/88924/431129e5-946d-3107-99ce-36cfb53ef31e.png)

 

使用方法非常简单，只要先[下载这组CSS](http://www.red-root.com/sandbox/holmes/holmes.latest.zip "holmes") ，嵌入到页面中，然后在body的class中添加holmes-debug这个 值，打开页面后就会看到检测结果了。

 

据官方文档说，Holmes.css完美支持以下浏览器

- Google Chrome 10+
- Safari 5+
- Opera 10+
- Firefox 3.5+

而对IE8只是有限支持。

 

官方网站 [http://www.red-root.com/sandbox/holmes/](http://www.red-root.com/sandbox/holmes/ "holmes") 上还有Bookmarklet可以直接拖到浏览器书签，点击后即可测试当前页面。