Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I wrap long lines without spaces in contenteditable

Hy, I've tried everything and nothing works.

I have this fiddle: http://jsfiddle.net/kauqdk9j/

<div id="test" contenteditable="true"></div>

#test { width:400px; height:30px; font-size:13px; border:1px solid #333; word-wrap:break-word; word-break: break-all;white-space: nowrap}

I've tried in CSS: word-wrap:break-word; word-break: break-all;white-space: nowrap, and nothing happens. Can someone help me with this issue please?

like image 982
Iulian Miu Avatar asked Feb 10 '15 21:02

Iulian Miu


People also ask

How do you wrap a long string without any whitespace character?

You can wrap a long string, which does not have any whitespace character by using the CSS word-wrap property, or overflow-wrap, if you use CSS3. In this snippet, you'll find some examples for block elements, as well as for the inline ones.


1 Answers

wrap

#test {
    width:400px;
    height:30px;
    font-size:13px;
    border:1px solid #333;

    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

nowrap

#test {
    width:400px;
    height:30px;
    font-size:13px;
    border:1px solid #333;

    word-wrap: normal;
    overflow-wrap: normal;
    white-space: nowrap;
}
like image 151
alessandrio Avatar answered Nov 23 '22 09:11

alessandrio