/    Sign up×
Community /Pin to ProfileBookmark

how to center webpage

hi, i used dreamweaver to build my site. but i just realize that the page is to the left on a higher resolution monitor. i tried a couple methods i found in the forum but none works. also when i open up my site firefox my border colors on the right side border the color is correct but on the left border the color is a different shade. any help will be appreciated. thanks

to post a comment
HTML

19 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 20.2005 — Got a link so we can see what you're talking about?
Copy linkTweet thisAlerts:
@bathurst_guySep 20.2005 — well to centre it you place it all inside a container div if it isnt already, then give the body a text-align: center; and the container a margin: 0 auto; and specify a width, either px em or whatever depending on your other measurements. As for the different colours is a little strange, as long as they are specified as the same they should look the same, it may be an interference on your monitor somewhere? any thing else electrical/magnetical or the like near by..
Copy linkTweet thisAlerts:
@ZarelSep 20.2005 — well to centre it you place it all inside a container div if it isnt already, then give the body a text-align: center; and the container a margin: 0 auto; and specify a width, either px em or whatever depending on your other measurements. As for the different colours is a little strange, as long as they are specified as the same they should look the same, it may be an interference on your monitor somewhere? any thing else electrical/magnetical or the like near by..[/QUOTE]

Make sure the width is a max-width. You don't want it to looked messed up in lower resolutions.
Copy linkTweet thisAlerts:
@KravvitzSep 20.2005 — [url=http://www.dynamicsitesolutions.com/css/center_element/]How to Center Elements with CSS (in IE5+/Win and other browsers)[/url]
Copy linkTweet thisAlerts:
@ableauthorSep 20.2005 — Got a link so we can see what you're talking about?[/QUOTE]
this is my website [URL=http://www.datzwhatzup.net]here[/URL]
Copy linkTweet thisAlerts:
@ableauthorSep 20.2005 — well to centre it you place it all inside a container div if it isnt already, then give the body a text-align: center; and the container a margin: 0 auto; and specify a width, either px em or whatever depending on your other measurements. As for the different colours is a little strange, as long as they are specified as the same they should look the same, it may be an interference on your monitor somewhere? any thing else electrical/magnetical or the like near by..[/QUOTE]
i tried your method and it didnt work me is there any other way. thanks
Copy linkTweet thisAlerts:
@KravvitzSep 21.2005 — It won't work right because you are using so much absolute positioning.

You could add a <div> wrapper and give it position:relative. Then the method that bathurst_guy suggested should work.
Copy linkTweet thisAlerts:
@ableauthorSep 21.2005 — It won't work right because you are using so much absolute positioning.

You could add a <div> wrapper and give it position:relative. Then the method that bathurst_guy suggested should work.[/QUOTE]

thanks, but can u give me <div> wrapper code.
Copy linkTweet thisAlerts:
@KravvitzSep 21.2005 — div.wrapper {
position: relative;
width: 780px;
margin: 0 auto;
}
&lt;body&gt;
&lt;div class="wrapper"&gt;
...
&lt;/div&gt;
&lt;/body&gt;
Copy linkTweet thisAlerts:
@ableauthorSep 22.2005 — div.wrapper {
position: relative;
width: 780px;
margin: 0 auto;
}
&lt;body&gt;
&lt;div class="wrapper"&gt;
...
&lt;/div&gt;
&lt;/body&gt;
[/QUOTE]

ok i did that but still doesn't work what am i missing.
Copy linkTweet thisAlerts:
@bathurst_guySep 22.2005 — well u musnt of done it properly
Copy linkTweet thisAlerts:
@e-realmzSep 22.2005 — I wouldnt know if this method is any better or worse but I use <table align=center border=0><tr><td> Entire site here!!! </td></tr></table>

I don't know if thats a good technique but it works well for my site. ?
Copy linkTweet thisAlerts:
@ableauthorSep 22.2005 — well u musnt of done it properly[/QUOTE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Datzwhatzup-Your Premier Source For Party &amp; Events Images</title>

<style type="text/css">

<!--

body { margin:0; background-color: #F2F2F2; text-align: center;

}

#div.wrapper {

position: relative;

width: 780px;

margin: 0 auto;

}

#container { margin:0 auto; width: 780px;

}

a:link {

color: #FF8C1A;

text-decoration: none;

}

a:hover {

color: #FFFFFF;

text-decoration: underline;

}

a:visited {

color: #FFFF00;

text-decoration: none;

}

.style11 {color: #f9ff11}

a:active {

text-decoration: none;

}

.style12 {color: #FF8C1A; font-family: Palatino; }

.style13 {color: #FF8C1A; font-family: Palatino; font-size: x-large; }

-->

</style>

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_reloadPage(init) { //reloads the window if Nav4 resized

if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

</head>

<body>

<div class="wrapper">

<div id="container">entire site



</div>

</div>

</body>

</html>
Copy linkTweet thisAlerts:
@PicasaSep 22.2005 — I'm a newbie...how do I bullet items? Thanks.
Copy linkTweet thisAlerts:
@MiruvorSep 22.2005 — Theres a couple list types, but for bulleting.

<ul>

<li>List Item</li>

<li>List Item</li>

</ul>
Copy linkTweet thisAlerts:
@e-realmzSep 22.2005 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Datzwhatzup-Your Premier Source For Party &amp; Events Images</title>

<style type="text/css">

<!--

body { margin:0; background-color: #F2F2F2; text-align: center;

}

#div.wrapper {

position: relative;

width: 780px;

margin: 0 auto;

}

#container { margin:0 auto; width: 780px;

}

a:link {

color: #FF8C1A;

text-decoration: none;

}

a:hover {

color: #FFFFFF;

text-decoration: underline;

}

a:visited {

color: #FFFF00;

text-decoration: none;

}

.style11 {color: #f9ff11}

a:active {

text-decoration: none;

}

.style12 {color: #FF8C1A; font-family: Palatino; }

.style13 {color: #FF8C1A; font-family: Palatino; font-size: x-large; }

-->

</style>

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_reloadPage(init) { //reloads the window if Nav4 resized

if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

</head>

<body>

<div class="wrapper">

<div id="container">entire site



</div>

</div>

</body>

</html>
[/QUOTE]




[SIZE=4]All that just to center a page. I guess my way really is better.[/SIZE]
Copy linkTweet thisAlerts:
@PicasaSep 22.2005 — bullets work great, but now how to keep single spacing between bullets? thanks.
Copy linkTweet thisAlerts:
@KravvitzSep 22.2005 — Single spacing? What do you mean?

Next time, Picasa, please start your own thread.

[b]e-realmz[/b], most of that code is not used for centering. There is no good reason to use a table just for horizontal centering. Read this: [url=http://www.dynamicsitesolutions.com/css/center_element/]How to Center Elements with CSS (in IE5+/Win and other browsers)[/url]

[b]able[/b], '#div.wrapper' should be 'div.wrapper'. Also, you don't need both #container and div.wrapper; you only need one of them.
Copy linkTweet thisAlerts:
@ableauthorSep 23.2005 — Single spacing? What do you mean?

Next time, Picasa, please start your own thread.

[b]e-realmz[/b], most of that code is not used for centering. There is no good reason to use a table just for horizontal centering. Read this: [url=http://www.dynamicsitesolutions.com/css/center_element/]How to Center Elements with CSS (in IE5+/Win and other browsers)[/url]

[b]able[/b], '#div.wrapper' should be 'div.wrapper'. Also, you don't need both #container and div.wrapper; you only need one of them.[/QUOTE]

thanks to all who help.. i finally got it to work. anyone have any ideas with color situation i have in the original thread. thanks ?
×

Success!

Help @able 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...