pixel.gif, why do people use it?

最后都变了- 提交于 2020-05-27 03:58:08

问题


Just a simple question, why is pixel.gif usefull? And why should you use it or why not?


回答1:


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.




回答2:


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:

  1. As an asset that can be used for marketing analytics (i.e. email opened?)
  2. For spacing issues arising from using tables for layout in email.

Email clients do not universally support CSS so it is best practices to code your newsletters and application alerts as if it were 1996.




回答3:


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.




回答4:


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!



来源:https://stackoverflow.com/questions/5593740/pixel-gif-why-do-people-use-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!