Centering page for browsers

liunx

Guest
I'm VERY new to HTML and I know the layout isn't the greatest, but my skill hasn't caught up to the popularity of it however...<br />
<br />
Anyway, here is my question. I want my webpage when viewed (the homepage) to be centered no matter what size browser the user is using. Its hard to balance between 8x6 and 1024x768. If I use 8x6 it looks like crap in 1024... And I don't want users to scroll if they are using 8x6... <br />
<br />
I designed (clears throat) the site to be simple so there is room for it to move around. Is there such a script out there that could help me? I have seen scripts that allow this to happen with pop-ups, but I HATE popups!<br />
<br />
:)<!--content-->O, you're gonna want to table that- alter the percentage in the with="%" bit below.<br />
<br />
<center><br />
<table width="75%" border=0 bordercolor=#colorcode cellspacing=0 cellpadding=0><tr><td valign=top><br />
<br />
muck about with it. you can get color codes from <!-- w --><a class="postlink" href="http://www.htmlcolorcodes.com">www.htmlcolorcodes.com</a><!-- w --> . 'Ave fun<!--content--><body style="text-align:center"><br />
<br />
and then do all your widths in pecentages.<!--content-->Forget percentages for the moment. I think you want it to stay the same size yet have it all centered on all browsers so that there is no real difference to layout.<br />
<br />
If I am correct I suggest you do the following. Don't design with 800 pixels width in mind but 750. This takes into considration the scroll bars and other things for macs and pc's as well as browser type. This is called Live space. So design at 750 width.<br />
<br />
Create yourself a parent table as follows.<br />
<br />
<table align="center" width="750"><br />
<tr><br />
<td><br />
Insert all of your page in here. You will have the same view on all browsers.<br />
</td><br />
</tr><br />
</table><br />
<br />
My page does exactly this. See link to Ent Imp below. Nothing of content there, but the example is valid.<br />
<br />
Hope that is cool for you.<!--content-->Thanks to everyone for the tips. I'm going to have to experiment.<br />
<br />
Thanks.<!--content-->I did my site with a 3 column frameset, set the colums as "*,800,*" then the site is always centered and 800 pixels wide, all extra space is distributed evenly on either side.<br />
<br />
just a thought....<!--content-->well, a couple of things. You should only use a frameset when absolutely necessary.... and in this case, it absolutely ISN'T. Using a frameset that is 800 pixels wide will still scroll in a 800x600 res. There was no need to use a frameset when you already had working examples, all you did is make it harder for search engines to index your page. Although your method works, its probably the least favorable choice. Why? because you still need to design your pages to fit 800 wide... which your frameset does nothing to.<!--content-->I have a website (i arent allowed to post the address of it because of some of the links on it) which is designed using frames. I originally designed it for 1024 but have changed my mind to 800.<br />
<br />
What I would like to know is what percentage of people have browsers that support iframes and also can iframes be used to place a framed page inside?<!--content-->why use iframes when regular frames work? <br />
<br />
as far as I know, Iframes are a microsoft thing... but with the advent of N6 (and now N7) the world of netscape seems larger than ever.<!--content-->I have never used inline frames and never will. Not all browsers support them. With XHTML and CSS 2.0 gaining some momentum I frames will become a thing of the past. CSS is able to insert a scroll bar to any data that doesn't fit a table cell or a float. <br />
<br />
The quicker browser producers get the their thumbs out, and head towards a common platform of operation the quicker we shall not have to discuss what percentage of users can view I frames.<br />
<br />
Oh... we shall still have to consider those who have a strange emmotional pull to NS 4.0 and 600 pixel width screens. So we will still be discussing it I guess.<!--content-->OK, the best way to get your site centered in the browser window is to have a containg table (coloured green) and inside that table have your site (table coloured red). Check out the code below. I've coloured the table backgrounds to make it easier. Also the inner table size is set to 760x408 which will not give any scroll bars when viewed at 800x600. Personally I hate horizontal scroll bars with a pashion! Vertical scroll bars are ok as long as the page isn't 2 miles long... users would get fed up with scrolling! <br />
<br />
Hope this helps! <br />
<br />
<html> <br />
<head> <br />
<title>WHATEVER</title> <br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <br />
</head> <br />
<br />
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <br />
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#999900"> <br />
<tr> <br />
<td align="center" valign="middle"><table width="760" height="408" border="0" cellpadding="0" cellspacing="0" bgcolor="#3366CC"> <br />
<tr> <br />
<td align="center" valign="middle">THIS WOULD BE YOUR WEBSITE</td> <br />
</tr> <br />
</table></td> <br />
</tr> <br />
</table> <br />
</body> <br />
</html><!--content-->
 
Back
Top