Hallo zusammen,
ich würde gerne drei übereinanderliegende Elemente in der Browsermitte zentrieren.
http://img851.imageshack.us/img851/6554/layer.th.jpg
Im habe ich ein Hintergrundbild mit background-position: center zentriert. Darüber befindet sich ein halbtransparenter Layer mit position:relative, margin:auto. Die beiden Elemente stehen ordnungsgemäß auf Mitte im Browser.
Das oberste Element, die Navigationsleiste, bekomme ich aber nicht vom linken Rand des darüberliegenden divs weg - egal, in welches tag ich nun position:relative / margin:auto schreibe. Woran mag das liegen?
Hier das HTML:
[HTML]
- {
margin: 0;
padding: 0;
}
body {
font-family: „Lucida Grande“, Verdana, Helvetica, Arial, sans-serif;
font-size: 9px;
background-image: url(media/himalaya2.jpg);
background-repeat: no-repeat;
background-position:center;
color: rgb(51, 51, 51);
}
#layer {
position: relative;
margin:auto;
width: 900px;
height: 768px;
background-color: rgba(255,255,255,0.7);
border: 1px solid white;
-moz-border-radius: 7px;
}
#navbar {
position: relative;
top: 50px;
}
#navbar ul, #navbar ul li {
height: 25px;
float: left;
}
#navbar ul {
-moz-border-radius: 7px;
list-style-type: none;
}
#navbar ul li {
width: 110px;
text-align: center;
background-image: url(media/bg_button.png);
background-position: bottom;
background-repeat: repeat-x;
background-color: white;
border-top: 1px solid rgb(220,220,220);
-moz-box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.4);
line-height: 28px;
}
#navbar ul li:first-child {
-moz-border-radius-topleft: 7px;
-moz-border-radius-bottomleft: 7px;
}
#navbar ul li:last-child {
border-bottom-style: none;
-moz-border-radius-topright: 7px;
-moz-border-radius-bottomright: 7px;
}
#navbar ul li a {
font-size: 11px;
color: rgb(80,80,80);
font-weight: bold;
text-decoration: none;
display: block;
}
#navbar ul li a:hover {
background-color: #87a8b9;
color: #fff;
}
[/CODE]