4

What is wrong with this? Ive read a couple of posts which suggest that in order to have inline-block elements all on the same line with only overflow-x, the following CSS is all that is required on the parent:

div { 
overflow-x:scroll;
overflow-y:hidden;
white-space:nowrap;
}

This is my CSS, straight from my firebug for both the parent, and the elements which i need on the same line. The elements are wrapping with only a vertical overflow. Im confused. Any suggestions?

.elementsRequiredOnSameLine {
background: none repeat scroll 0 0 white;
display: inline-block;
float: left;
height: 10em;
text-align: center;
width: 6em;
}

.parent{
display: inline-block;
margin: 10px auto;
min-height: 12em;
overflow-x: scroll;
padding: 10px;
white-space: nowrap;
width: 95%;
}
4

2 に答える 2

5

要素で使用すると、ルールfloat: leftが無視されます。nowrap既に を使用してdisplay: inline-blockいるため、要素を並べて表示するために要素をフロートする必要はありません。取り除くだけfloat: left

于 2013-02-25T02:16:39.847 に答える
0

Was because of the float:left;, once i removed that, fine. Spotted it after typing out question sorry.

于 2013-02-25T02:13:04.597 に答える