469,964 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

Image tag with CSS background attribute

Hi, I've got an Image (a transparent png) over a background (a jpeg).
I'd like them to stretch toghether.
I've tried:
<img src="MyImage.png" alt"foreground image" width"100%" height"100%"
background-image: url(MyBackground.jpeg);
background-repeat: no-repeat;
background-size: 100%;" />

Doing so I can correctly see the png over the jpeg, but when I resize the window I got the png stretched while the background jpeg doesn't move.
Why doesn't it work?
Feb 5 '08 #1
1 1263
Death Slaught
1,137 1GB
Your background image won't stretch because it is 'part' of the page itself so to speak. It can't be resized because you would have to increase the size of the browser itself (which isn't possible).

You can put two images in the same 'container' and give one of them a z-index

^_^ Thanks, Death
Feb 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by MediaDesign | last post: by
5 posts views Thread by Derek Fountain | last post: by
5 posts views Thread by Doug Laidlaw | last post: by
7 posts views Thread by roN | last post: by
5 posts views Thread by Michael | last post: by
8 posts views Thread by John | last post: by
9 posts views Thread by Cartoper | last post: by
4 posts views Thread by GArlington | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.