advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
Rate this item | 0 users have rated this item.
 Print Print
 
Optimizing Design: One-pixel GIFs
Single pixel GIFs can be a useful workaround design element. 
advertisement
Single Pixel GIF Trick

n the early days of web design, HTML limitations inspired designers to find all sorts of workarounds in order to have control over the layout of pages. One of the most significant of these workarounds was the single pixel GIF trick, using a single pixel GIF and modifying it with the height, width, hspace, and vspace attributes of the IMG tag.

The GIF itself is tiny and requires virtually no download time. And, depending on whether the single pixel is transparent or not, the result can be used as a spacer, or as a horizontal or vertical rule.

Before the advent of Cascading Style Sheets (CSS), the single pixel GIF was the only thing that provided reliable control of white space across browser versions and platforms. Though the trick is still useful, setting CSS margin and indent properties is a better solution for spacing when your readers are using CSS-compliant browsers.

How to make and use a single pixel GIF

  1. Use your graphics program and create a one-pixel-by-one-pixel indexed color image of the color you wish to use. Or, to create a spacer GIF, make it transparent.
  2. Save the image. Store it with a name you can remember and easily use, like "onepixel-green.gif" or "spacer.gif."
  3. If you are editing HTML by hand:
    1. At the point in the HTML file where you want to use the single pixel GIF, insert the image tag:
      <img src ="onepixel-green.gif"
    2. Add the height and width (or hspace and vspace) attributes, setting them at the size you'd like the rule, box, block, or spacer to be:
      <img src ="onepixel-green.gif" width=10 height=100
    3. Add an align attribute to specify the alignment:
      <img src ="onepixel-green.gif" width=10 height=100 align=left
    4. End the tag:
      <img src ="onepixel.gif" width=10 height=100 align=left>
    5. Preview your page in the browser.
  4. If you are using an HTML editor:
    1. Place the single pixel GIF where you want it on the page
    2. With the single pixel GIF highlighted (don't click elsewhere on the page, it will be very difficult to highlight it again)
    3. Enter the new height and width (or hspace and vspace) values into the properties palette.
    4. The single pixel GIF will visibly adjust on the page to reflect these values.
  Next Page: Rules, Shapes, Spacing and Placement
Page 1: IntroductionPage 2: Rules, Shapes, Spacing and Placement
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES