Warum "inline-block" - Elemente in ein "nowrap" div overflow?

Folgende code bewirkt, dass #Schlagzeile zum überlauf #wrapper, und ich verstehe nicht, warum dies geschieht.

HTML:

<div id="wrapper">
    <div id="logo">
        <img src="/test.png">
    </div>
    <div id="headline">
        <h1>This headline overflows its wrapping div. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #</h1>
    </div>
</div>

CSS:

#wrapper {
    background: #fea;
    white-space: nowrap;
    width: 50%;
}

#logo {
    display: inline-block;
    vertical-align: middle;
}

#logo img {
       width: 6em; 
}

#headline {
     display: inline-block;
     vertical-align: middle;
     white-space: normal;
}

Beispiel-code: http://jsfiddle.net/XjstZ/21/ oder http://tinkerbin.com/XvSAEfrK

InformationsquelleAutor Markus | 2012-07-03

Schreibe einen Kommentar