![]() |
positioning something in the center of the screen with css
how would i go about doing this, always wondered how and never ever knew bar creating a table but that's long. :(
wheres all the html guru's :( |
You could put it in a container if you're talking about a whole page...
div#container { margin-left: auto; margin-right: auto; width: 50em; } or you could use "text-align: center;" would work in some cases... |
will that vertically align it center too? as the left right bits a doddle it's the vertical aligning that's the problem.
|
vertical-align: middle;
I believe is what you're looking for then. |
You may need to give the body element height:100% to center its contents vertically with a vertical-align, and for this to work in IE, you need to be sure to give your page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> or another doctype specifier that tells it to use its better CSS interpretation at the top (it needs to be the topmost line in the document, before <html>), otherwise it interprets it differently and it won't work. |
And for browsers to not use "quirks mode" rendering, your doctype definition needs to be comlete (including the URI of the referenced doctype) otherwise it's llike having no doctype at all.
|
<a href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html" target="_blank">http://www.jakpsatweb.cz/css/css-ver...-solution.html</a>
|
Actually, that depends on the doctype. That particular one does not need a URL to work propperly.
|
thanks all, you been a great help :)
|
All times are GMT. The time now is 02:01 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|