Log in

View Full Version : Stretch image in css



hemi519
01-27-2011, 07:34 AM
Hi All,


iam using a background image with position relative in css. I want to increase the height of image more than it is,

this is my code

#background { background: url('img/Background.jpg') no-repeat center center; height: 600px; width: 1024px; position: relative; margin: 0px auto; }

and in html under body section iam calling this by

<div id=background>

when i want to increase the size of background to morethan what it is. image is just moving down. How to fix this issue.

As my total page is going to be 1024 x 600 i need it to be fixed in all pages such that there should not be any side bar or bottom page bar is it possible. Currntly i am giving border as 50px for the body section. which is give me different types of height in different types of screens.

azoomer
01-27-2011, 04:43 PM
The css you have is defining the size and position of the background div, but it doesn't affect the image size. Maybe the easiest way to get around this is to resize the background image itself. You can do that with photoshop or gimp. An online alternative can be found here (http://www.resizeimage.4u2ges.com/index.asp). On that page you will be able to upload your image and enlarge it to the desired dimensions.

Deadweight
01-27-2011, 06:12 PM
i have photoshop CS5 so if u want me to change the size or whatever u want just email me

CRAZYKLD_68@YAHOO.COM (lower case tho)