|
|
|
|
#1 (permalink) |
|
Regular Poster
|
Hi All
Could any one out there please advise me on how to center a website equally from top to bottom. I've done this before with centering left to right. The site I have in mind is around 700px height, 2500px width and would scroll from left to right. No space would be required from either the left or right.....if that makes any sense!!! Cheers Guys Leon
__________________
L2 Design Solutions |
|
|
|
|
|
#2 (permalink) |
|
New Poster
Join Date: Apr 2009
Posts: 1
|
Centering your page in the HTML code:
Open the html web page in a text editor or an html editor (in an html editor go to the view that shows the source code). hello............ ![]() Near the top of the code, locate the tag for the main table Type align="center" within the table tag. File > Save to save your changes. Centering your page in CSS: Open the .css file that came with your template in a text editor or html editor Locate the BODY section (usually near the top). If there is no BODY section already written, create one. Type: BODY{ } Within the Body section, type: margin-left: auto; margin-right: auto; text-align: center; Note: "text-align: center" centers your entire web page, not just text. This line is necessary for many browsers that do not recognize the "margin auto" commands. File > Save to save the .css file. |
|
|
|
|
|
#5 (permalink) |
|
Regular Poster
|
I've tried the above suggestions but to no avail with what I'm trying to achieve.
Please view the website in question posted below. I would like the site to center equally in between the top and bottom of the browser. ROAR Collective-Sheffield Creative Design Company Cheers Leon
__________________
L2 Design Solutions |
|
|
|
|
|
#6 (permalink) |
|
New Poster
Join Date: Apr 2009
Posts: 3
|
I think the problem is that the suggestions so far are about horizontal centering, and I think you want to know about vertical centering.
This used to be the "go to" link about vertical centering with CSS: Dead Centre More recently, this has become popular too: Vertical Centering in CSS Another method is forcing a containing table's height to 100% and then setting the valign attribute of the cell (td tag) to middle, but I this sort of layout manipulation using tables is deprecated, and hardcore table-haters will frown upon you. |
|
|
|
|
|
#9 (permalink) |
|
New Poster
Join Date: Jul 2009
Posts: 3
|
You will have to play with the css a little to your exact requirements, but this is pretty much what you need...
------------------------------------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unpublished Website</title> <style> #container { width:460px; /* - change this figure to suit -*/ position: absolute; top: 50%; left: 50%; margin-left: -250px; /* - change this figure to suit -*/ margin-top: -140px; /* - change this figure to suit -*/ text-align:center; } </style> </head> <body> <div id="container"> put your content here </div> </body> </html> |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
All times are GMT. The time now is 12:25 PM.











Linear Mode




