Jun 16
Removing Gaps Under Images In CSS
icon1 James Smith | icon2 Web | icon4 June 16th, 2008| icon3

CSS veterans will probably already know this, but here’s a fix to a problem which has been bugging me for ages.

Problem:

If you have something like:

<div>
    <img src=... />
</div>

You may see a gap below the image on some browsers, a gap which cannot be removed by setting the padding/margins to 0:

Solution:

<img> tags are rendered using display: inline by default, which means they act and flow like text does on a page. In order to stop spaces being added (caused by spaces next to the img tag in your html), you should set your img to use display: block.

<img style="display: block" src="..." alt="" />

This means your image will no longer act like flowing text and will no longer have a gap below it!

Caveats:

Changing from display: inline means your img tag will ignore things like text-align: center, and other alignments specific to displaying elements inline.

Image credit: buhsnarf on flickr

Jun 13
The Original Microblogger
icon1 James Smith | icon2 Blogging | icon4 June 13th, 2008| icon3

I’ve just been reading an article about the diarist Robert Shields, who sadly passed away last year, describing his amazing “condition”.

Robert was thought to have hypergraphia, an overwhelming urge to write, and detailed every action of his life meticulously in a collection of diaries. The entries chronicled every 5 minutes of his life.

Every mundane, boring detail, such as the following gem:

July 25, 1993
7 am: I cleaned out the tub and scraped my feet with my fingernails to remove layers of dead skin.
7.05 am: Passed a large, firm stool, and a pint of urine. Used five sheets of paper.

It struck me how similar this was to the actions of heavy twitter users (I will refrain from mentioning specific names!), tweeting every insignificant detail of their lives.

Twitter’s growth problems aren’t a new phenomenon either, Robert too suffered from service scaling issues as his diaries piled up to fill 94 cartons.

These diaries are now in the safe hands of Washington State University, but won’t be released to read for another 49 years. I can barely contain myself.

Robert Shields was a true pioneer. I salute you!