Click to See Complete Forum and Search --> : Center positioned web page


Mashka
10-27-2007, 01:41 AM
Hi. I'm really new in web designing. Does anybody know how to create web page as in following web site http://www.firsttechcu.com/
I want to be able make my web page similar with all text and images placed in the center. How is it done???? Help! Please.

scragar
10-27-2007, 04:56 AM
in your head add:
<style type="text/css">
body{
text-align: center;
}
</style>

WebJoel
10-27-2007, 07:12 AM
text-align:center 'centers' the text in the container. If you want the container to be centered as in the URL cited, you state a WIDTH (either in px or %), and "margin:0 auto;"

<div style="width:500px; border:3px double gray; margin:0 auto;">

<p>At vero eos et accusamus et iusto odio dignissimos ducimus,
qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias
<strong>exceptur</strong>i <strong>sint, obcaecat</strong>i <strong>cupiditat</strong>e <strong>non pro</strong>v<strong>ident</strong>, similique <strong>sunt in culpa</strong>, <strong>qui officia deserunt mollit</strong>ia <strong>anim</strong>i, <strong>id est laborum</strong>et dolorum fuga.
</p>

</div>


This method requires a valid !doctype, else it fails in IE.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Mashka
10-27-2007, 11:45 PM
thanks, I'll try it

hitecbill
10-28-2007, 09:18 AM
Hi. I'm really new in web designing. Does anybody know how to create web page as in following web site http://www.firsttechcu.com/
I want to be able make my web page similar with all text and images placed in the center. How is it done???? Help! Please.

personally, i would make left and right margins 'auto'...then that leaves you free to align what's inside, how you wish.

that site you posted seems to have been laid out using tables, which to the webdev snobs, that is a terrible mistake (apparently)...:rolleyes:

but in your css maybe it would look like this:

body table
{ margin-left:auto;
margin-right:auto;
}

but obviously the table should be set to 80% width, or a set number of pixels...

or you could make it a specific class and set the table to that class:

.maintable
{ margin-left:auto;
margin-right:auto;
}


then <table class="maintable" etc etc

or as is what you are supposed to use is a containing div...

so we could use that class for a div:

<div class="maintable">

...

</div>




hope this helps...i'm not an expert :)

soccermatrix
10-28-2007, 09:57 PM
I've been using this CSS for a few years to center pages.

body {
text-align:center;
}
#wrapper {
width:974px;
margin:0 auto;
padding:0;
text-align:center;
}

and then you put all your site div inside the wrapper div.