1Danke
ERLEDIGT
NEIN
NEIN
ANTWORTEN
2
2
ZUGRIFFE
544
544
EMPFEHLEN
-
Hallo an alle!
Ich benötige dringend eure Hilfe.
Ich habe folgenden Code:
Zwischen "Erste Ausgabe" und "Zweite Ausgabe" soll ein kleiner Abstand sein (in diesem Fall 8px).HTML-Code:<body style="background-color: blue;"> <!-- Erste Ausgabe //--> <div style="margin-bottom: 8px;"> <div style='background-color: white;'> <div style="float:left;">hier steht text</div> <div style="float:right;"><img src="" /></div> <div style='clear:both;'></div> </div> </div> <!-- Zweite Ausgabe //--> <div style="margin-bottom: 8px;"> <div style='background-color: white;'> <div style="float:left;">hier steht text</div> <div style="float:right;"><img src="" /></div> <div style='clear:both;'></div> </div> </div> </body>
Dieser hat (normalerweise) die Farbe blau (body-background). Im IE6 + IE7 nimmt er allerdings die Farbe weiß, von dem darunter liegendem div-Container. Kann mir jemand erklären wie das kommt? Übersehe ich etwas? Im Firefox, Chrome, ... wird es richtig gemacht.
Vielen Dank für Hilfe!!
-
Die Ursache findet sich hier im hasLayout.
Lösung:
Code xhtml:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<body style="background-color: blue;"> <!-- Erste Ausgabe //--> <div style="margin-bottom: 8px; height:1%;"> <div style='background-color: white;'> <div style="float:left;">hier steht text</div> <div style="float:right;"><img src="" /></div> <div style='clear:both;'></div> </div> </div> <!-- Zweite Ausgabe //--> <div style="margin-bottom: 8px; height:1%;"> <div style='background-color: white;'> <div style="float:left;">hier steht text</div> <div style="float:right;"><img src="" /></div> <div style='clear:both;'></div> </div> </div> </body>
Noch ein Tipp zum Schluß: Anstelle des inhaltsleeren <div>-Elements, das ausschließlich zum Abbruch der Floats dient, bietet CSS eine weitaus elegantere Technik, insbesondere wenn es im HTML-Code mehrfach benötigt wird, und so den Quellcode unnötig aufbläht:
Geändert von spicelab (07.09.10 um 18:56 Uhr) Grund: Zusatz-Info
-
Klasse! Wieder habe ich etwas dazu gelernt! Ich danke dir sehr******
Ähnliche Themen
-
margin-bottom im IE7
Von dobber812 im Forum CSSAntworten: 4Letzter Beitrag: 19.07.09, 21:37 -
Firefox schluckt margin-bottom und margin-right
Von JackLevin im Forum CSSAntworten: 6Letzter Beitrag: 12.09.08, 13:49 -
SELECT problem margin-bottom in zelle
Von cool-catti im Forum CSSAntworten: 1Letzter Beitrag: 25.09.05, 20:28 -
abstände zwischen tabellenzellen mit margin-top, margin-bottom
Von verozame im Forum HTML & XHTMLAntworten: 1Letzter Beitrag: 13.12.04, 13:51 -
margin-bottom
Von unlord im Forum HTML & XHTMLAntworten: 3Letzter Beitrag: 02.06.04, 16:40





Zitieren
Login




