Archive for January, 2008

New shoes!

Thursday, January 31st, 2008

I hope they fit.  :)

Replace valign with CSS

Saturday, January 26th, 2008

For those trying to break away from using tables for layout and do things in CSS, the loss of the valign attribute is a problem.  For some reason, the CSS people never imagined that we’d want to center anything vertically.

You might have tried to use the CSS vertical-align property in your div and discovered it had no effect.  The reason for this is that div is a block element and vertical-align only applies to inline elements.  So we need to use an inline element like span.  But wait, you say, inline elements can’t have a height specified!  Quite so.  But we can emulate height with the line-height property.  So we just wrap the content to be centered in an inline element with a line-height that’s the same as the parent block’s height and presto!

For example:

<div style="width: 200px; height: 50px; text-align: center; border: 1px solid;">
     <span style="line-height: 50px; vertical-align: middle;">
          Vertically centered!
     </span>
</div>

Vertically centered!

 It’s a bit of a hack, but what about web design isn’t?  :)

Finding Emo

Saturday, January 26th, 2008

OK, I confess.  I read icanhascheezeburger.com.

funny pictures

But c’mon, that’s funny.  :)

The Horror of Blimps

Tuesday, January 22nd, 2008

I literally laughed until I cried when I read this one.  :)

The Horror of Blimps

Cross-browser dynamic JavaScript events with DOM

Thursday, January 17th, 2008

I have wrestled at length with a good DOM-based way to dynamically add JavaScript events to a page.  After much Googling, I pieced the following together from a number of different suggestions (credit to whoever you are). I eventually gave up on DOM because IE’s implementation is so broken, but this part works well.

It uses eval() to execute the action, so it’s not the most elegant thing, but it’s functional.

Example and source: