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"> </a>
</td>
</tr>
</table>
</body>
</html>
[Back to original message]
|