.jpg img white background clashes with html page white background
My site uses a .jpg jpeg image as the top-of-page image on all pages of the site. The image was created with a white background. But using the img src="topOfEveryPageImage.jpg" tag shows that the image's white background is visually different from the rest of the solid white background of the browser page. The 'white' of the image is noticeable and not the same as the white of the browser page.
Yet the image was created on the very same computer using a .jpg authoring program. And in the .jpg authoring tool, the image's white background looks like solid white and identical to the white of the browser window if I launch the browser on the same computer.
Is the "img" html tag interfering with the .jpg background color? Here is the actual code:
<a href="mysite/landingPage.php">
<img src="mysite/images/topOfEveryPageImage.jpg"
alt="mysite/images/topOfEveryPageImage.jpg"
</img>
</a>
One of those "whites" actually isn't #ffffff
, then. Most image editing programs allow you to specify the color using this format; use the same color that your page's background uses.
Alternately, the image might have an embedded color profile, where the image's "white" could be visually very different from the webpage's notion of "white" - in that case, remove the color profile before using the image for the web.
JPEG is a lossy format that cannot reproduce original colors accurately. Normally you wouldn't have the JPEG and the original shade for side-by-side comparison, and wouldn't notice the difference.
You should use the PNG format whenever the colors need to match. Or better yet, use alpha transparency and you'll be able to change webpage color without modifying the image at all.
Notice that the PNG format is best suited for screenshots, simple button/layout graphics and such, where there are large solid surfaces or even gradients, with no random noise. If the image contains photographs or other similar material, PNG won't compress very well and you get a large file. If the picture has been previously compressed in JPEG format, it is eternally ruined and needs to be recreated (or at least thoroughly cleaned up in an image editor) before saving as PNG to gain any of the PNG format benefits (otherwise it'll only take up more space than the original JPEG).
链接地址: http://www.djcxy.com/p/42224.html上一篇: 协议相对网址方法无法在Chrome中使用