17 January 2007 ›
28 comments
PNG Overlay: Example | Download (44 KB)
Have
you ever run into the problem of creating a site with pictures given by
the client, only to find later after they update their photography the
original look and feel is not retained? For instance, you might add a
drop-shadow, rounded corners (maybe both) or some other graphical
effects applied to the images. This is all well and good, but what
about the webmaster or journalist who follows after you – Will he or
she be able to keep the look consistent?
In order to help
remedy this potential problem, here is a solution that I came up with.
Basically, it involves creating a transparent PNG overlay which can be used as a mask / frame around regular JPEG or GIF. This way, a typical CMS
installation can be configured so users can upload photos without
having to worry about using any graphics program to apply filters. Even
if you are already a whiz with graphics, it will help save you time.
The nice thing about this method is that you are just applying an absolutely positioned <div>
with a PNG backround over the top of a regular image, so you still get the benefits of a relevant alt
attribute / value pair, as well as printing images because they are
technically in the foreground as far as the browser is concerned. It
will even work in IE6, with the proprietary Microsoft alpha style filter applied. IE7 will handle the transparency natively.
I
am not going to go in depth and explain how to make transparent
overlays, because there are already plenty of Photoshop tutorials out
there. For a good explanation of how to achieve this effect in
Fireworks, check out the article at solarDreamStudios. I hope this demo inspires ideas and makes life easier.
还有一个css圆角效果: http://www.htmldog.com/examples/images3_3.html