Moin,
wie kann ich im Firefox die Elemente bzw. den Text zentrieren, wenn ich keine Breitenangabe machen kann (also width: auto)?
Hier mal ein Beispiel-Code:
<!DOCTYPE XHTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<title>Test</title>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
border: 0px;
width: 100%;
height: 100%;
}
div#nav {
position: absolute;
left: 0px;
top: 0px;
width: 200px;
background-color: #F5F5F5;
color: #000000;
}
div#text {
position: absolute;
left: 205px;
top: 0px;
width: auto;
height: 100%;
color: #FFFFFF;
background-color: #330066;
}
h1 {
margin-left: auto;
margin-right: auto;
text-align: center;
}
</style>
</head>
<body>
<div id="nav">
Navigation
</div>
<div id="text">
<h1>Das hier soll in der Mitte stehen</h1>
</div>
</body>
</html>
Die Position der beiden div-Elemente muss absolute sein, da sie sich sonst in die eigentliche Seite nicht einfügen lässt.