Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering

Status
Not open for further replies.

ice78991

Programmer
Nov 20, 2006
216
Using tables, it is easy to
center the page vertically and horizontally (<table height="100%"> etc) on the screen

How is this best done using css
 
For the width, you could use a "container" div and use "margin: 0 auto".


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks. I'm trying to workk out how to center in terms of the height ? Is there a way which is compatible with all browsers?
 
or is this one area where it is better to stick to tables?
 
I have been getting quite close with the following

<div style=" margin-left: 50%; margin-top: 25%">
SomeText
</div>

Not sure why margin-top: 50% goes off screen though.
 
awesome I was about to start a topic on this. Thanks :}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top