html - How to allow text to spill outside div

ID : 274324

viewed : 39

Tags : htmlcsshtml





Top 3 Answer for html - How to allow text to spill outside div

vote vote

100

Try this:

<div style="width: 20px; white-space: nowrap;">Some text here</div> 
vote vote

87

When a div has the attribute white-space: no-wrap, its child elements inherit the same property. If you would like child elements to wrap, you can use white-space: normal;

jsFiddle

Of course this works, but if the amount of divs using normal out-weighs the amount of divs using nowrap, I would suggest isolating the nowrap text by placing it in its own div.

jsFiddle

vote vote

76

Top 3 video Explaining html - How to allow text to spill outside div







Related QUESTION?