html - How would I make a <div> automatically make a new line judged on the input? -


what mean is, possible make div when type stuff div, automatically makes new line each new line in code detects? example, want this:

<div>     hello, world!     how doing today? </div> 

which return

hello, world!
how doing today?

which in reality requires <br> or something. don't want have put millions of them make simple lines. code put before outputs this:

hello, world! how doing today?

i want automatic new line judged on code's enters. possible?

use css white-space property.

<div style="white-space:pre">     hello, world!     how doing today? </div> 

note preserve white space, including multiple spaces (such indent). if want collapse white space still use newline characters indicate line breaking, can use pre-line value, though option not supported in ie7 (if matters you).

see live example: http://jsfiddle.net/vyme6xs8/1/


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -