You are here: Re: [CSS] Div-Tag and Vertical Align « HTML « IT news, forums, messages
Re: [CSS] Div-Tag and Vertical Align

Posted by Martin Pöpping on 08/21/06 19:13

dorayme schrieb:

> Divs are 100% wide in relation to their containers (eg. body) by
> default. So if you want one centred, you need to give it a width
> smaller than the container in which you want it to appear but big
> enough to hold the content that is inside it (this needs careful
> though often). Then you need to instruct it to centre. This
> usually works:
>
> margin-left: auto;
> margin-right: auto

Thanks for your hint!
I´m half ready now ;)

My code as smallest example looks like this:

<html>
<head>

<title>TEST</title>

<style type="text/css">
<!--
div#border{

height: 600px;
width: 410px;
vertical-align: middle;
text-align: center;
border: solid 1px #526e86;
margin: 0 auto;
}
-->
</style>

</head>

<body>
<div id="content">&nbsp;</a>
</body>

</html>



How can I center it horizontally?

E.g. I want it centered in the middle of the page like this:


--------------------------------------
| |
| |
| |---------| |
| | DIV | |
| |---------| |
| |
| |
|-------------------------------------|





Regards,

Martin

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация