Reputation: 15959
Just a simple question, why is pixel.gif usefull? And why should you use it or why not?
Upvotes: 8
Views: 3865
Reputation: 620
Here in 2024, the transparent single-pixel .gif still has a use.
GitHub Flavored Markdown is abysmally anemic when it comes to alignment capabilities. CSS doesn't work, most HTML alignment-related attributes don't work, and Markdown itself has practically no provision for alignment. So, I just today used the transparent .gif alignment technique to vertically align the centers of download buttons and corresponding version badges in a GitHub README file.
Occasionally it's useful to know the old ways. :^)
Upvotes: 0
Reputation: 51
Shim .gif's are transparent images typically 1x1 pixel in size. As noted above, these images should not be used for spacing in modern web browsers (2013) as CSS does a superior job of layout.
However, email marketing campaigns continue to leverage them for a couple of reasons:
Email clients do not universally support CSS so it is best practices to code your newsletters and application alerts as if it were 1996.
Upvotes: 5
Reputation: 3652
Just because of IE. IE 7-8 cant properly work with background png + opacity. There are only one way to fix it:
background: url("/images/blank.gif") no-repeat, url("/images/howto.png") no-repeat;
background-color: transparent !important;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled="true", sizingMethod="crop", src="/images/howto.png");
zoom: 1;
IE is not a browser. I cant say anything except bad words about this program. I have now a great amount of bugs marked IE 7 ONLY, IE 8 ONLY, IE 8 in compability mode with IE 7 ONLY, IE 9 ONLY and IE 10 ONLY
Users, please! Drop windows and all its delirium to the hell. Use GNU/Linux!
Upvotes: 1
Reputation: 16848
Pixel gifs (often called shim.gif) were used in older web designs (i.e. older than, say, 5 years ago) to provide a space in page or table layouts where a better understanding of robust CSS was lacking or if browser differences (typically between IE and Netscape) made life too complicated.
They should be considered a relic of the past and would not be seen in a professional CSS layout in today's web design. However it is still possible that older pages that haven't been maintained over the years will still have table-based page layouts with pixel shim images to provide some artificial spacing for columns.
In short, you should not use them unless an image is required for non-javascript statistics gathering for your site.
Upvotes: 11
Reputation: 58531
Because through history, browsers have had various issues with rendering empty elements, and sizing elements correctly. Using a transparent pixel image and stretching it as content was a fairly universal method to get an element to resize correctly, and the pixel could be put in a hyperlink ending up with a transparent, clickable area on any browser.
Nower-days, browsers and browser technology have improved greatly, and I think it has been years since I used a pixel.
Upvotes: 2