Mozilla/Firefox/Gecko focus box resizing fix

July 28, 2007

I had an element which was focussable, but firefox resized it larger in order to display the focus rect, which caused scroll bars to appear and other annoying side-effects.

Here’s a piece of css which puts the focus rectangle inside the box, and in doing prevents the box from growing and changing the layout:

*:focus
{
-moz-outline-offset: -1px !important;
}