Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Sep 4, 1998

Getting Spaced Out

HTML's page layout features are limited for older browsers--tables provide one of the few ways you can force text or graphics to appear in particular positions. Another addition to your armory of layout tools is judicious use of spacer graphics.

A spacer graphic is a one pixel by one pixel transparent GIF (easily created in almost any bitmap graphics application). You can resize this spacer graphic using the HEIGHT and WIDTH properties of the <IMG> tag to force other page elements adjacent to it to appear in the position you want. What's more, it hardly adds any overhead to download times.

For example, this code forces the text to start 50 pixels from the left margin of the page:

 
<HTML>
<HEAD>
<TITLE>Spacer GIF Example</TITLE>
</HEAD>
<p>
<BODY>
<IMG SRC="spacer.gif" HEIGHT=1 WIDTH=50 BORDER=0>This text starts 50 pixels from the 
left margin.
</BODY>
</HTML>
Martin Kelly
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap