Jump to content

need help with display


zed420

Recommended Posts

Hi All

 

Can some please put me in right direction I've created my first site, the problem is when you change the monitor resolutions it doesn't streach with it. It's seems fine at 1024 x 768 but if you change the reslustion to 1080 x 1024 there quite a lot of empty space on right side, Why ????  I've created two big divs and kept all others inside them.

 

#banner { 
	position: relative;
	height: 150px;
	width: 986px;
}
#main { 
	position: relative;
	height: 19cm;
	width: 26.2cm;
}

Link to comment
Share on other sites

It is because you are using pixels ('px'). Pixels are a precise measurement, much like centimeters are. Pixels will not strech if you change the resolution, so 100px will always be 100px no matter what resolution you are using.

 

What you need is to use either percentages (%) or not set the width at all, in which case the browser will figure it out itself.

 

You could do it like this with percentages:

 

#banner { 
	position: relative;
	height: 150px;
	width: 80%;
                        margin-left: 10%;
                        margin-right: 10%;
}
#main { 
	position: relative;
	height: 19cm;
	width: 20%;
}

 

The above code is just an example. You will need to adjust the numbers yourself.

 

If you do not set the width yourself, you can instead give BODY some left and right padding:

 

body { 
	padding-left: 5%;
	padding-right: 5%;
}

 

Also: You should not use centimeters ('cm') in your stylesheets. They should only be used in stylesheets for printers. Instead you can use: px, em, ex and %.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.