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"> </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]
|