« Aim Spam, what the heck are we coming to?
When Life Gives You Lemons You Paint That Shit Gold »

CSS diagnostics script

I recently found a really cool script comprised of 100% CSS that will check to make sure your css is valid. All you have to do is add this code to your current CSS file and it automatically highlights all of the possible code mistakes on the page.

/* Empty Elements */

div:empty, span:empty, li:empty, p:empty, td:empty, th:empty 

{ padding: 20px; border: 5px dotted yellow !important; }

/* Empty Attributes */

*[alt=""], *[title=""], *[class=""], *[id=""], a[href=""], a[href="#"] 

{ border: 5px solid yellow !important; }

/* Deprecated Elements */

applet, basefont, center, dir, font, isindex, menu, s, strike, u 

{ border: 5px dotted red !important; }

/* Deprecated Attributes */

*[background], *[bgcolor], *[clear], *[color], *[compact], *[noshade], *[nowrap], *[size], *[start], 

*[bottommargin], *[leftmargin], *[rightmargin], *[topmargin], *[marginheight], *[marginwidth], *[alink], *[link], *[text], *[vlink],

*[align], *[valign],

*[hspace], *[vspace],

*[height], *[width],

ul[type], ol[type], li[type]

{ border: 5px solid red !important; }

/* Proposed Deprecated Elements */

input[type="button"], big, tt 

{ border: 5px dotted #33FF00 !important; }

/* Proposed Deprecated Attributes */

*[border], a[target], table[cellpadding], table[cellspacing], *[name] 

{ border: 5px solid #33FF00 !important; }

For more information check out: http://www.nealgrosskopf.com/tech/thread.asp?PID=3

Take care,
Nick

One Response to “CSS diagnostics script”

  1. Neal G Says:

    Thanks for the link Nick. I just came up with another method of using CSS to highlight 404 pages and old javascript functions as well.

Leave a Reply