Click to See Complete Forum and Search --> : Quick Question About Centering Websites
jackc4ss
10-23-2007, 02:40 PM
Hi,
I have this website located at
http://www.jackcass.com/uni/bass2/index.html
and I want the website to be centered into the middle of the webpage whenever someone scrolls or loads the page. An example of what I mean is
http://www.lenorek.com
(hopefully without that annoying sidebar on the side)
What is the code that I have to enter into to my page to make it do that? I couldnt find it anywhere but Im sure itll be so easy.
Hope you guys can help me out!
Edit: Also anyone who has a mac can you tell me if the site displays correctly. I have tested of IE, FF and Safari on a pc and all is good :)
GraphixNPrint
10-23-2007, 02:55 PM
well, what the example site did was place it all in a table..
<BODY topmargin=0 leftmargin=0 marginheight="0" marginwidth="0" ... body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">-->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="VERTICAL-ALIGN: top"><IMG height="258" src="images/keyBackGround.gif" width="40"></td>
<td style="VERTICAL-ALIGN: middle"> ...
the ... means I removed part that was boring and not needed here
since he has his body set to 100% for height he gets the scroll bar.
I would just use ALIGN=CENTER VALIGN=CENTER with the table height set to 90 or 95% so you can eliminate the scrolling (there is also a NOSCROLL attribut you can use but its not recognized by all browsers).
hope this helps
Jackimalyn
10-23-2007, 03:10 PM
first of all, please dont use tables for layout :) second, if you DO use tables for layout, use <table align="center">
jackc4ss
10-23-2007, 03:10 PM
Thanks GraphixnPrint I got it. Thanks!
However i put 100% as the height and I didnt get the scroll bar on the side so thats good.
GraphixNPrint
10-23-2007, 03:15 PM
first of all, please dont use tables for layout :) second, if you DO use tables for layout, use <table align="center">
hehe, jackie is right... well for current coding
I am still kinda old school from back in the early 90's ...
if you really wanna do it right you could set it all up using css and define everything there
JPnyc
10-23-2007, 03:22 PM
you can center things by either sending the margin to auto, or the parent element's padding to auto. An example;
margin: 5px auto;
urstwile
10-23-2007, 11:17 PM
Also anyone who has a mac can you tell me if the site displays correctly. I have tested of IE, FF and Safari on a pc and all is good :)
Looks fine to me, using Safari, Mac OS X 10.4.10. :) Here's a screenshot:
http://i24.tinypic.com/zv901y.jpg