I want to create a span with a fixed width that when I type any thing in the span like <span>lgasdfjksdajgdsglkgsadfasdfadfasdfadsfasdfasddkgjk</span>
, a long string of non-spaced text, the word(s) break or wrap to next line.
Any ideas?
You can use the CSS property word-wrap:break-word;
, which will break words if they are too long for your span width.
span {
display:block;
width:150px;
word-wrap:break-word;
}
<span>VeryLongLongLongLongLongLongLongLongLongLongLongLongExample</span>