如何让一组内联块元素在 div 内滚动
How can I make a group of inline-block elements scroll inside of a div
我的 <footer>
中有一堆 <label>
个元素。现在,标签在超过 <footer>
的宽度时换行。
如何让标签在页脚内水平滚动?
这是一个 JSFiddle,标签在其中进行换行。
http://jsfiddle.net/DTcHh/5088/
很简单:
footer {
background: black;
padding: 10px;
overflow-x: auto; /* scrollbar only when needed */
}
footer .btn-group {
font-size: 0; /* eliminates the white space gap between non-floated .btn s */
white-space: nowrap; /* prevents child inline .btn s from wrapping to the next line */
}
footer .btn-group .btn {
float: none;
}
This 应该帮忙。使用:
white-space: nowrap;
防止它换行开始,然后:
overflow-x: scroll;
让它使用滚动条。
我的 <footer>
中有一堆 <label>
个元素。现在,标签在超过 <footer>
的宽度时换行。
如何让标签在页脚内水平滚动?
这是一个 JSFiddle,标签在其中进行换行。 http://jsfiddle.net/DTcHh/5088/
很简单:
footer {
background: black;
padding: 10px;
overflow-x: auto; /* scrollbar only when needed */
}
footer .btn-group {
font-size: 0; /* eliminates the white space gap between non-floated .btn s */
white-space: nowrap; /* prevents child inline .btn s from wrapping to the next line */
}
footer .btn-group .btn {
float: none;
}
This 应该帮忙。使用:
white-space: nowrap;
防止它换行开始,然后:
overflow-x: scroll;
让它使用滚动条。