CSS Hacks – Highlight Well Formed Elements


CSS can be used in creative ways, by using CSS attribute selection, it’s easy to isolate image tags without alt attribute and link tags without title and link attribute.

Note: support for these substring selectors is confined to Safari, Gecko-based browsers, Opera, and IE7/Win.


CSS Code:

<style type="text/css">
/*
style all images that have an alt attribute, thus
highlighting those images that are correctly formed
*/
img[alt] {border: 3px solid red;}
/*
to boldface the text of any HTML hyperlink that
has both an HRef and a title attribute
*/
a[href][title] {font-size:200%;}
</style>

Demo:
http://www.highub.com/lab/css-hack1.php

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

, , , , , , , ,

  1. No comments yet.
(will not be published)