HTML : How to retain formatting in textarea?
What you want is a Rich Text Editor. The standard HTML <textarea>
tag only accepts plain text (even if the text is or includes HTML markup). There are a lot of example out there (including some listed on the page linked) but I would highly recommend using a prepackaged one for this. Coding your own is fairly complicated for people who are new, and even for a lot who have some experience. Both TinyMCE and CKEditor are very common ones, but there are many others as well.
Preserve line breaks in textarea
Generally you just need to add
white-space: pre-line;
whitespace trimmed to single whitespace orwhite-space: pre-wrap;
all whitespace preserved
to the element's style (CSS), where you want your text rendered with line-breaks.
Can I embed HTML formatting inside of a textarea tag?
I am pretty sure the answer is no -- cannot do it with a textarea.
From the MDN docs:
The HTML <textarea> element represents a multi-line plain-text editing control.
- Permitted content Text
How to send text area data with formatting to a database and retrieve it the same way
You can take the user entered list (or any rich-text) store it in mongodb as HTML.
Check this article for more details about how to do it: Link
This should give you the flexibility to add meta-information about making the text bold, italic etc.
Related Topics
Elements in a Flex Container Are Not Wrapping
How to Semantically Tag Poem Text
What's The Difference Between Meta Name and Meta Property
How to Set A:Link Height/Width with CSS
Fill a Div with an Image Respecting Aspect Ratio
How to Remove This Horizontal Scrollbar in Bootstrap 3
How to Make a Div Take The Full Width of The Page When It Is Inside Another Div That Have 90% Width
Disable Opacity on Child Element When Parent Element Has Opacity
Opening a New Tab to Read a PDF File
How to Apply Mix-Blend-Mode While Keeping Text Opaque
Apply Different CSS Stylesheet Depending on Browser Window Size - I Can't Find Anything Definitive
Prevent Ligatures in Safari (Mavericks/iOS7) via CSS
Why Does HTML5 Recommend Putting The Code Element Inside Pre
Enable Vertical Scrolling on Textarea
Pseudo Element Not Full Container Width When Border Used