Is it possible to add a line break on each white space using CSS?
For example, if I have string \"Format It\"
I would like to display it like
You can use the word-spacing
property. It defines the space between the words. If you set it to the size of the container, it will force a line break...
Since it doesn't accept percentual values, you can use relative values like vw
.
div {
word-spacing: 100vw;
}
http://jsfiddle.net/ApL3h/
A solution would be to make it not wide enough, the standard white-space
handling will make the lines wrap :
p {
width:1px;
}
demonstration
But it really depends on your use case and specific needs.