Search
Archives

You are currently browsing the ZMeier.com blog archives for January, 2014.

Archive for January, 2014

You can use white-space: pre; to make elements act like <pre>, which preserves newlines.

Example:

<style> p { white-space: pre; } </style> <p>hello How are you</p> 

On this note in  <pre>Line 1\nLine2\nLine\n</pre> Will show up as 3 lines.

This is great for many things including WordPress plug-in’s and Drupal Modules where you input is textarea now you can simply capture text and simply show it as the user input’s it.

Finally the use for this particular scenario was to build a custom tab,   in the textarea I am allowing the customer to define readable tags (i.e. <subheader></subheader>) and now I can format text within the tag to their specifications.