Is there a way to avoid wrapping of a div
's
content when the content is not just text e.g. several buttons?
CSS nowrap for other than text elements?
white-space:nowrap;
should do the trick.
#foo {
white-space:nowrap;
width: 100px;
}
<div id="foo">
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
<input type="button" value="hello"/>
</div>
Demo doesn't work in my browser (Chrome 60.0.3112.113). I had to add "overflow:hidden" to "#foo". –
Twink
You can set both these properties in CSS:
white-space:nowrap;
and max-width:something;
You can declare static positions for the other contents using
position:absolute;
© 2022 - 2024 — McMap. All rights reserved.
overflow: hidden
? Please let as know what "wrapping" means – Oppresswhite-space: nowrap
does not work for buttons.Button
elements are text content, in HTML and CSS terms. – Billiondisplay: inline-block
to the elements that still wrap. It should follow thewhite-space: nowrap
rule. I'm instead facing the problem of having it also to not overflow but resize the parent element. – Cartilage