Spacer GIF

A spacer GIF is a small, invisible GIF image that is used in web design and HTML coding. They were used to control the visual layout of HTML elements on a web page, at a time when the HTML standard alone did not allow this. They became mostly obsolete after the adoption of Cascading Style Sheets.

History

David Siegel's 1996 book Creating Killer Web Sites was the first known to publish the Spacer GIF technique. According to Siegel, he invented the trick in his living room.[1][2]

The Cascading Style Sheets (CSS) standard diminished the use of spacer GIFs for laying out web pages. CSS can achieve the same effects in a number of ways, such as by changing the margin or padding on a given element or by explicitly setting a relative position.

Usage

It was recognised early on that although the size of table cells could not be set directly, each cell could contain an image through an <IMG> tag. The size of image tags could be set independently, with their WIDTH and HEIGHT attributes. To avoid the computational cost of rescaling the image, which could be considerable on contemporary hardware, the HSPACE and VSPACE attributes were recommended over setting the height and width.[3]

The displayed size was controlled entirely by the attributes and was independent of the actual size of the image that was used. Accordingly, the same image file could be used for all the spacer images needed on a web page, leveraging browser caching. The only requirement was that this image was invisible, either by being the same color as the page, or by being transparent.

GIF files were used as it was a common format that supported transparency, unlike JPEG. PNG also supports transparency, but was in its infancy during this time, with poor browser support.

Drawbacks

Designs produced often looked perfect on the designer's display, but could look entirely different on the reader's display. Different screen resolution, browser rendering engines, as well as user font preferences, could change the layout of the design considerably. Implementing a design with spacer GIFs could be extremely tedious - particularly when making small changes to an existing design.

Obsolescence

The technique was obsolete for designing web pages by the beginning of the 21st century. Implementation of CSS allowed sizes of HTML objects to be set directly. Although CSS' adoption was slow, owing to poor browser implementations and developer inertia, the basic ability to control element placement as enabled by the use of spacer GIFs was usable by about 1997.

In addition, table- and grid-based layouts were replaced by fluid layouts in an attempt to respond to the growing use of mobile devices to access web content. These design methodologies abandoned the attempt to control two-dimensional layout between elements. Instead the elements would be offered to the reader's browser and the browser would place them as best it could, according to the size of the reader's browsing window. Fluid design layouts made the setting of page element sizes on the user's browser less important. This was particularly evident where it removed the need to set sizes in absolute units such as pixels.

Although seldom used in web sites, the comparatively limited rendering engines built into popular email clients makes the technique still occasionally useful when designing HTML email.

References

    1. Rønn-Jensen, Jesper (2006-03-03). "Justaddwater: Who invented the Spacer GIF". Justaddwater. Retrieved 2006-11-26.
    2. Siegel, David (1997-10-02). "The Web is Ruined and I Ruined it". XML.com. O'Reilly Media. Retrieved 2015-07-08.
    3. "BLANK .GIF IMAGE (SPACER)". here's a transient problem with blank images in that they will display a "ghost" image during download, then disappear and become invisible when download is complete - e.g., if you make the blank image 20 pixels wide (WIDTH=20), it will display a 20-pixel-long line until the page is fully loaded. For an excellent workaround to the probelm, use the HSPACE and/or VSPACE attributes and leave the image at 1x1.

    External links

    This article is issued from Wikipedia - version of the 11/16/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.