|
|||
![]()
Hi,
im Code sind ein paar Div mit einander verschachtelt. Wenn ich bei Div1 position:relative entferne, werden bei den nachfolgenden Div's position:absolute nicht mehr in Div1 ausgeführt, wie es ja sein sollte, sonden im Body. hat jemand eine Erklärung warum? oder was mache ich falsch? Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>div verschachteln</title> <style type="text/css"> <!-- div { background-color:#CCCCCC; border:1px solid black;} //--> </style> </head> <body style="text-align:center"> <div style="position: relative; width:840px; height:500px; background-color:maroon;"> <div style="position: absolute; left:0; top:0; width:20px; height:500px;">r1</div> <div style="position: absolute; right:0; top:0; width:20px; height:500px;">r2</div> <div style="position:relative; width:800px; height:160px;">Bereich 1</div> </div> </body> </html>
__________________
nix is fix cu bk |
Sponsored Links |
|
|||
![]()
Das ist normal.
Absolut positionierte Container richten sich immer am Elternelement aus - das kann ein anderes absolut positioniertes Div sein, ein mit position:relative versehenes Div oder eben der Body sein - bei Divs, die mit position:static (Normaleinstellung) positioniert sind, geht eine absolute Positionierung der darin befindlichen Divs nicht - sie richten sich dann am nächsten Elternelement - meistens dem Body - aus. |
Sponsored Links |
|
|||
![]() Zitat:
Siehe auch - http://www.w3.org/TR/CSS2/visuren.html#propdef-position - http://www.w3.org/TR/CSS2/visuren.ht...te-positioning - http://www.w3.org/TR/CSS2/visuren.html#containing-block |
![]() |
Themen-Optionen | |
Ansicht | |
|
|
![]() |
||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
Fragen zu CSS und Joomla | DOKTOR | CSS | 2 | 23.05.2011 19:29 |
Brauche Hilfe: Schwarzes Nichts | Zwox | CSS | 10 | 19.11.2010 16:53 |
Header entfernen | tripple | CSS | 17 | 15.06.2010 15:41 |
Schriftfarbe in den Eintragungsfeldern von jforms | Steveislucky | CSS | 2 | 16.03.2010 10:59 |
CSS Text nebeinander? | carstiee09 | CSS | 13 | 13.11.2009 19:18 |