DIV inline-block + Breite 100%

Kann ich nicht anzeigen, ein paar DIV ' s in einer Zeile. display: inline-block und float: left funktioniert nicht. Meine Website-Breite ist nicht fixed so möchte ich es dynamisch und passt sich so jeder Breite des Bildschirms.


HTML:

<div id="all">
    <div id="a">25px</div>
    <div id="b">200px</div>
    <div id="c">
        <div id="c1">100%</div>
        <div id="c2">100%</div>
        <div id="c3">100%</div>
    </div>
    500px
</div>

CSS:

DIV {
    margin:5px;
    font-size:10px;
}

DIV#all {
    width:500px;
    border:1px dotted black;
}

DIV#a {
    display:inline-block;
    width:25px;
    height:200px;
    border:1px solid red;
    color:red;
}

DIV#b {
    display:inline-block;
    width:150px;    
    height:200px;
    border:1px solid green;
    color:green;
}

DIV#c {
    display:inline-block;
    width:auto;
    height:200px;
    border:1px solid blue;
    color:blue;
}

DIV#c1 {
    width:auto;
    border:1px dotted blue;
    color:blue;   
}

DIV#c2 {
    width:auto;
    border:1px dotted blue;    
}

DIV#c3 {
    width:auto;
    border:1px dotted blue;   
    color:blue;
}​

Live-Demos:

Sie möchten float:left nicht display:inline-block
Es gibt einige inkonsistente Verhalten in Ihrer Lösung. Wenn man genauer hinsieht, dem mittleren div-B1 sollte 200 Pixel breit, aber es ist nicht. Es hat die Breite nur 150 px. Irgendeine Idee, warum?

InformationsquelleAutor clavish | 2012-08-02

Schreibe einen Kommentar