|
|||
background-color bei div wird nur bei position:asbolue angezeigt.
Hallo,
ich hab ein Problem, dass ich nicht verstehe. Ich habe im body-tag einen div#content in dem wiederrum ein div#container liegt, dem eine Hintergrundfarbe zugeordnet ist. Die Hintergrundfabe wird aber nur sichtbar, wenn ich bei den styles position:absolute angebe. Im div#container sind wiederrum mehrere div#wrapper. Wenn ich position static lasse wird die Hintergrundfarbe nicht angezeigt. Hat das evtl. was mit dem Stapelindex zu tun? Hier mal der html-code: HTML-Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <style ="media" type = "text/css"> #content { position:absolute; left:50%; margin-left:-550px; width:1100px; } #title { font-size:48px; color:#ffffff; margin-top:50px; } #container { position:absolute; background-color:#E1F0FF; border-radius:10px; } #wrapper { float:left; width:500px; margin-left:25px; margin-right:25px; margin-bottom:20px; width:400px; height:200px; background-color:#ff0000 } </style> </head> <body text="#ffffff" bgcolor="#000000 link="#FF0000" alink="#FF0000" vlink="#FF0000"> <div id="content"> <div id="title"> Titel </div> <div id ="container"> <div id="wrapper"> bla </div> <div id="wrapper"> bla </div> <div id="wrapper"> </div> <div id="wrapper"> </div> <div id="wrapper"> </div> <div id="wrapper"> </div> </div> </div> </body> </html> |
Sponsored Links |
|
|||
Hallo!
Dein Problem ist, dass dein Container ohne das Position:absolute keine Höhe hat, weil der Content aus dem Container rausragt. Das Problem kannst du z.B. mit einem <br style="clear:both" /> (für dich würde auch ein clear:left reichen) nach dem letzten Wrapper lösen. Mehr Infos zu der Problematik findest du in der FAQ unter Punkt 2: http://xhtmlforum.de/40267-faq-h-ufi...ragen-und.html LG Michael
__________________
Walter IT-Services Michael Walter http://www.walter-it.de http://blog.walter-it.de Geändert von Walter IT-Services (07.11.2011 um 20:59 Uhr) |
Sponsored Links |
Stichwörter |
background-color, div |
Themen-Optionen | |
Ansicht | |
|
|
Ähnliche Themen | ||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
CSS - CMS - lange Menus Balken/BG oben? | shinobi | CSS | 3 | 13.10.2011 21:12 |
CSS Problem - Finde den Fehler nicht... | expou | CSS | 4 | 27.04.2011 12:31 |
Frage zu horizontalen Linien | marvin1989 | CSS | 3 | 29.12.2009 23:35 |
Footer left und right Probleme... | wolf1985 | CSS | 2 | 14.08.2008 13:04 |
BG Image im IE wird nicht angezeigt?! ohje! | smash | CSS | 13 | 03.11.2006 19:31 |