Am I doing something wrong or does CSS not like percentages for background image sizes? If I set an image size with percent instead of px (or not at all) the image height gets cropped. For Example: #menu { background: url(images_homepagenew/menu.gif) no-repeat; width: 100%; height: 100%; margin: none; text-align: center; } OR #menu { background: url(images_homepagenew/menu.gif) no-repeat; margin: none; text-align: center; } OR #menu { background: url(images_homepagenew/menu.gif) no-repeat; width: 523px; height: 66px; margin: none; text-align: center; } The first two examples simply crop the height to about 20% of its original size. The third example is the only one that keeps the image at its full size.
You set your width/height to 100% but 100% of what? It's the parent element. What is the parent set to?
Am I right in thinking that its a percentage of whatever its inside not of the original image? so in this case 50% would be 50% of 845px not 50% of the orginal size of the image?
yes, that is correct. however, the issue when you put height: 100%; is that there is no defined height in the container, so there's nothing to base that percentage on.
Uhm, I think people are missing the guys actual question.... Because setting a size on an element does not change the size of a BACKGROUND image. Background images cannot be resized... which is why it gets cut off. That is the entire BASIS of sliding-background methods like sliding-doors or my "eight corners under one roof". The width you are declaring on #menu is NOT EVER going to change the size of menu.gif - because you are changing the size of the CONTAINER - NOT THE IMAGE.