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
Format
It
using CSS.
A white space can be a sequence of spaces (entered using the space or the tab keys) or a line break (entered using the carriage return key (or the Enter key), or <br/> ).
Press ALT+ENTER to insert the line break.
HTML Break (<br>) Tag If you want to insert a line break, use the HTML break tag, written as <br>. You don't need a closing tag here — just writing <br> adds a line break.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With