Dynadot โ€” .com Registration $8.99

Code for center middle website

Spacemail by SpaceshipSpacemail by Spaceship
Watch

escortech

Established Member
Impact
0
I want to center my website but have it in the middle of the screen

im just using frontpage to do this nothing like Style sheets etc.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
At the beginning of your body put this is in

HTML:
<div align="center">

And at the end...

HTML:
</div>
 
Last edited:
0
•••
actually, you forgot the last >. it should be <div align="center"> and then </div after the content.
 
0
•••
Mhm ever tried dreamweaver?
 
0
•••
So you want everything centered, the text centered or the tables centered?

To center everything but the text just put align="center" in the <body> tag.
 
0
•••
Palyriot said:
actually, you forgot the last >. it should be <div align="center"> and then </div after the content.
lol, although you are correct ;). You've also forgotten the ">" after your "</div" lol :D
 
0
•••
Palyriot said:
actually, you forgot the last >. it should be <div align="center"> and then </div after the content.

Woops..didn't catch that. I'll edit :)
 
0
•••
i know how to center the site but i want it in the middle of screen so

---------
|
Site here
|
---------

that came out harsh :| i tried <div align ="center" valign"middle">

but didnt work :(
 
Last edited:
0
•••
It worked for me:
<head>
<link href='css/layout.css' rel='stylesheet' type='text/css'>
</head>

where layout.css contains:
.main {
height: auto;
width: 760px;
margin-right: auto;
margin-left: auto;
}

After the '<body>' tag:
<div class='main' id='main'>
and before '</body>':

Hope it works for you.
 
0
•••
Here...

Code:
<div style="margin:0 auto"> Layout goes here. </div>

One line.

You want everything in the middle... did you make sure to include a '=' with your VALIGN? So within the content div that holds the actual text, include
Code:
valign="middle"

and in the CSS, you may even want to give a class to the div and put

Code:
vertical-align:middle;

Hope this helps.
 
Last edited:
0
•••
if its a table, simply put align="center" valign="center" for it and it shall work. otherwise, the <div align="center"></div> should work as well.
 
0
•••
ohhh, that's what you mean, well, I've made a few pages where I want everything in the vertical middle of the page. You need to make an outter table with width 100% and height 100%, and then set vertical-align: middle; and text-align: center. Then, put your site in the middle of that. It will then re-align to the middle of the page whenever the browser size is changed. Hope this helped :).
 
0
•••
of course you could just use

<center>
CONTENT
</center>

seems a little simpler to me
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back