` Not a standards-compliant Web browser, but a remarkable imitation — imaginary family values

Last update on .

Typography freaks know that in a properly formatted block of text, the first paragraph should not be indented, but the first line of every subsequent paragraph should be. On the Web, you can describe this kind of formatting in CSS2 as follows:

 p { text-indent: 0; }  p + p { text-indent: 0.2in; } 

Unfortunately, IE doesn’t understand the p + p selector. IE does allow you to insert Javascript into a stylesheet, so I can fake the selector like so:

 p { text-indent:expression(         (this.previousSibling == null ||          this.previousSibling.tagName != "P") ?         "0" : "0.2in"     );   } 

Javascript within stylesheets is yet another Microsoft feature with a security flaw hidden inside it, but I promise I will only use my Web hacks for good, never for evil.

Well … hardly ever for evil.

inspired by Svend Tofte’s max-width hack via dive into mark b-links

Similar entries


Pingbacks are closed.


Comments are closed.