• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

div außerhalb der parentdiv durch float:left

Animal21

Neues Mitglied
Hallo leute,

könnt ihr mir sagen, warum folgender effekt eintritt? (einfach eine html-datei mit diesem code erzeugen)
HTML:
<!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>Unbenanntes Dokument</title>
<style type="text/css">
    div#page{
        margin:0 auto;
        border:1px solid black;
        width:740px;
    }
    .zeile{
        width:100%;
        margin-bottom:5px;
        background:coral;
        border-top:1px solid black;
        border-bottom:1px dotted black;
    }
    .toLeft{
        width:33%;
        float:left;
        text-align:center;
        border:1px solid black;
    }
    .clearLine{
        width:100%;
    }
</style>
</head>

<body>
    <div id="page">
        <div class="zeile">
            Zeile 1
        </div>
        <div class="zeile">
            Zeile 2
        </div>
        <div class="zeile">
            Zeile 3
        </div>        
        <div class="zeile">
            <div class="toLeft">
                Ein Block 1!
            </div>
            <div class="toLeft">
                Ein Block 2!
            </div>
            <div class="toLeft">
                Ein Block 3!
            </div>
            <div class="toLeft">
                Ein Block 4!
            </div>
            <div class="toLeft">
                Ein Block 5!
            </div>
            <div class="toLeft">
                Ein Block 6!
            </div>
        </div>        
    </div>
</body>
</html>

Warum wird die div mit der id 'page' nicht automatisch erweitert, wenn die div's mit der class 'toLeft' gefloatet werden?

mfg
ani
 
Zurück
Oben