- This topic has 0 replies, 1 voice, and was last updated 7 years, 3 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Home › Forums › Tech › Web Development › DIV that doesn't wrap
This minimalist example will not wrap DIV2 into a second line. Both DIV1 and DIV2 will stay on the same line:
<div style="white-space: nowrap;">
<div style="display: inline-block;"> DIV1 </div>
<div style="display: inline-block;"> DIV2 </div>
</div>
Here is an output:
DIV1 DIV2
Here are the requirements:
-1- your container DIV should have white-space: nowrap;
-2- each of your cell DIV(s) should have display: inline-block;
Why this is important? – When you need to modify existing HTML, but you only have access to CSS.
RE:
– prevent DIV from wrapping to next line
– 2017-09-20 WE 10:33
© 2017 DomainWebCenter.com. All Rights Reserved. | Disclaimer | Contact the Editor