/    Sign up×
Community /Pin to ProfileBookmark

designing for different screen resolutions (800X600, 1024X768, etc.)

I’m having a big problem designing a web page for different screen resolutions. I built a website that looks great on 1024 x 768, but looks terrible in other resolutions. Everything gets jumbled up when viewing it in say 800 x 600. Also, whenever I look at my website in full screen, everything moves around. What are some steps I can do prevent this and make these pages look good on all screen resolutions?

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@DJsACSep 02.2006 — you could insert a php & javascript that selects a certain stylesheet based on the users' resolution.

Here's one I used for one of my sites:
[code=php]<?php
print "<script type="text/javascript">
<!--
function writeCookie()
{
var today = new Date();
var the_date = new Date("December 31, 3005");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
location = '".$_SERVER['REQUEST_URI']."';
}";

if (isset($HTTP_COOKIE_VARS["users_resolution"]))
{ $res = $HTTP_COOKIE_VARS["users_resolution"];
print " var php_screen_res = "".$res."";
var js_screen_res = screen.width +"x"+ screen.height;
if (js_screen_res != php_screen_res)
{
writeCookie();
}
//-->
</script>";
}
else
{
print " writeCookie();
//-->
</script>
" ;
}
if(!isset($res))
{
$res = "0x0";
$size = "Javascript is off";
echo "n<link href="stylesheet_default.css" rel="stylesheet" type="text/css" />n";
}
list($res_width,$res_height) = explode("x",$res);
switch (true) {
case (($res_width != 0) AND ($res_width <= 800)):
$size = "800 or lower";
echo "n<link href="stylesheet_800.css" rel="stylesheet" type="text/css" />n";
break;
case (($res_width>800) AND ($res_width<=1024)):
$size = "800 to 1024";
echo "n<link href="stylesheet_1024.css" rel="stylesheet" type="text/css" />n";
break;
case (($res_width>1024) AND ($res_width<=1280)):
$size = "1024 to 1280";
echo "n<link href="stylesheet_1280.css" rel="stylesheet" type="text/css" />n";
break;
case ($res_width>1280):
$size = "bigger than 1280";
echo "n<link href="stylesheet_1600.css" rel="stylesheet" type="text/css" />n";
break;
}


?>[/code]

Just place it in the header and rename the page to .php

Another option is to make the page fluid. Don't use sizes in pixels, but use percentages or em's.
Copy linkTweet thisAlerts:
@Rossario123Sep 02.2006 — correctly code your css layout.

use this a guideline to position each div element.

replace XX with a numerical value.

to center the page just make margin-left:-450px;

<i>
</i>.MyClassSelector{position:absolute;left:50%;top:XXpx;margin-left:XXpx;z-index:XX;}
×

Success!

Help @SithLordVader spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...