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:20

dorayme wrote:

> 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 help!

I have combined working example now but it uses the table-tag.

Does anybody know a solution taking the same effects only with using div
and without using a table tag?


Regards,

Martin



<html>
<head>

<title>TEST</title>

<style type="text/css">

<!--

html,body {
margin: 0;
padding: 0;
}

table {
width: 100%;
height: 100%;
}

td {
vertical-align: middle;
text-align: center;
}

div#border{

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

div#container {
position: relative;
text-align: left;
margin-left: auto;
margin-right: auto;
width: 780px;
height: 432px;
border: solid 1px #526e86;
}
-->
</style>

</head>

<body>
<table>
<tr>
<td>
<div id="container">&nbsp;</a>
</td>
</tr>
</table>
</body>

</html>

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация