Trying to centre a web page
- Started
- Last post
- 10 Responses
- Bite
I would like to create a site that when you increase the browser window size, the site stays in the centre of that window.
I can get it to centre horizontally but it is when i try to centre it verticle that it all goes wrong
can anybody explain????
- UndoUndo0
flash or html?
- rabattski0
just html? add a align=center / valign=center table within a table that has width & height set to 100%?
- Blofeldt0
Make a table with one cell and make it 100% wide by 100% high, then paste your site in the middle. By the way, height attribute is not W3C compliant so might not work in Firefox
- Bite0
HTML
- UndoUndo0
if yr using dreamweaver MX 2004 make sure you get teh latest update, we had a few problems with this before the update.
- Mario0
Try doing it with CSS.
Something like this:
//-------------------------
body
{
text-align: center;
}#container
{
width: 700px;
margin-left: auto;
margin-right: auto;
}
//-------------------------Wrap a DIV tag around your content in your HTML-document and give it the ID "container".
- ifThenGo0
quick fix, is creat a cingle cell table with a height and width of 100%.
Then set the TD tag to have align="centre" and valing="middle"
- rabattski0
valign=middle. had that wrong. you could also do it by javascript. just copy / paste the code from this site.
- Bite0
Thanks everyone I will give it a go
- T-Dawg0
if you're in dreamweaver, take this part out of the DOCTYPE at the top :
"http://www.w3.org/TR/html4/loos...then your 100% height table should work. Otherwise it adheres to the rules and regulations of w3 and height value is not recognized in your html.
rules were meant to be broken! :P