3 June 2005

Power of the unit em

I was posed a problem, and the solution was simpler than the thought process.

Basically, designer wanted a definition lists, but have all the terms the same length, but when text increases to not have them wrap.. and definition to become smaller.

I refused to used tables, but that would not of solved the problem. Then it dawned on me … use em for width.

So after fiddling around … I styled the <dt> as having a width in em, and float: left; then have the <dd> have a margin equal to (or greater) than that width.

See solution »

Try resizing text (smaller or larger)...

 

Comment



note: you can only submit after you hit preview


nuff-respec is a weblog written by daniel bulli a senior web programmer in boston, ma.
more >

contact | resume | profile | twitter

recently :::