ERLEDIGT
NEIN
NEIN
ANTWORTEN
3
3
ZUGRIFFE
586
586
EMPFEHLEN
-
Hallo zusammen,
ich versuche gerade mittels HTML und CSS eine Webseite zu erstellen.
Für das Layout wollte ich gerne das Box-Modell nutzen.
Mein bisheriger Code sieht wie folgt aus, das Problem ist das die graue Box unter der roten Box ist obwohl sie daneben sein soll.
CSS:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
@charset "UTF-8"; /* CSS Document */ #center{ margin:1em auto; width:601px; height:480px; } #header { position:relative; left:0x; top:0px; width:600px; height:40px; background-color: #ff0; } #menu { position:relative; left:0px; top:0px; width:225px; height:200px; background-color: #f00; } #content { position:inherit; left:0px; top:0px; width:375px; height:200px; background-color: #999; } #footer { position:relative; left:0px; top:0px; width:600px; height:40px; background-color: #ffff00; }
HTML:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>08.06.2011</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="center"> <div id="header">header</div> <div id="menu">menu</div> <div id="content">content</div> <div id="footer">footer</div> </div> </body> </html>
-
Kann mir niemand helfen?
-
Hallo,
das ist das normale Verhalten der Blockelemente entsprechend ihrer Anordnung im HTML. Diese Anordnung wird durch die relative Positionierung in deinem CSS nicht gestört.
Wenn du "menu"- und "content"-Block nebeneinander anordnen willst, dann könntest du beispielsweise den "content"-Block im "center"-Block rechts unterhalb des "header" absolut positionieren. Damit das funktioniert, müsste der "center"-Block relativ positioniert werden, alle anderen Elemente könnten im normalen Fluss bleiben:
Code css:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#center { position: relative; margin: 1em auto; width: 601px; height: 480px; } #header { width: 600px; height: 40px; background-color: #ff0; } #menu { width: 225px; height: 200px; background-color: #f00; } #content { position: absolute; right: 0; top: 40px; width: 375px; height: 200px; background-color: #999; } #footer { width: 600px; height: 40px; background-color: #ff0; }
-
Danke, so klappt es 1a
Ähnliche Themen
-
Erstes 3d-Modell
Von CarstenK im Forum Autodesk Maya (ehemals Alias)Antworten: 5Letzter Beitrag: 15.11.10, 21:08 -
ER-Modell
Von bsytkorbi im Forum Relationale DatenbanksystemeAntworten: 4Letzter Beitrag: 03.09.10, 13:04 -
ER-Modell
Von bennycy im Forum Relationale DatenbanksystemeAntworten: 7Letzter Beitrag: 16.11.08, 20:18 -
Modell ist zu grau, HL2 Modell, bitte um Hilfe!
Von daminator im Forum 3D Studio MaxAntworten: 6Letzter Beitrag: 17.05.05, 09:27 -
ER-Modell Frage!
Von DaJazz im Forum Relationale DatenbanksystemeAntworten: 4Letzter Beitrag: 22.11.04, 12:59





Zitieren


Login





