Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore spaces and break words by wrapping anywhere inside a text-area

Tags:

html

css

Is there a way to have a text-area wrap at any point and ignore spaces?

This is the behavior I have now:

| I want it to    |
| wrap anywhere   |

And this is what I'd like:

| I want it to wr |
| ap anywhere     |
like image 843
David Avatar asked Aug 28 '13 02:08

David


People also ask

What does word-wrap break word do?

The two properties ( word-break and word-wrap ) differ rules and overflow of words: as mentioned earlier, word-wrap is used to break words that overflow their container, while the word-break property breaks all words at the end of a line, even those that would normally wrap onto another line and wouldn't overflow their ...

How do you wrap text without spaces in HTML?

Replace spaces with   Then use the letter-spacing css attribute to bring the spaces down. I know, it's a hack... but if NOTHING else works, it should wrap without problem.

How do I keep text from wrapping in CSS?

If you want to prevent the text from wrapping, you can apply white-space: nowrap; Notice in HTML code example at the top of this article, there are actually two line breaks, one before the line of text and one after, which allow the text to be on its own line (in the code).

How do you break words in HTML?

The “word-break: break-all;” will break the word at any character so the result is to difficulty in reading whereas “word-wrap: break-word;” will split word without making the word not break in the middle and wrap it into next line. Example 1: This example display the break-all property values.


1 Answers

I found a solution by using the css3 "word-break: break-all" property.

textarea {
    border-width:1px;
    overflow: auto;
    border: solid;
    word-break: break-all;
}

See CSS3 word-break Property for more info.

like image 134
David Avatar answered Oct 13 '22 09:10

David