Encoding a tab in html

Html Entities

Html Entities Problem Overview


I can encode a space using   in an HTML document. Is there an equivalent for the tab character?

I'm trying to preload a <textarea> with text that contains tabs, but my CMS removes any tab characters that exist in the HTML code.

Html Entities Solutions


Solution 1 - Html Entities

After reviewing your edit, the answer is very simply: &#9; :)

Solution 2 - Html Entities

&emsp;, &ensp;, &#8195; or &#8194; can be used.

Read More at W3.org for HTML3

Read More at W3.org for HTML4

Solution 3 - Html Entities

The only way to encode a TAB character in pure HTML is to surround it with <pre></pre> tags, which turns your font into a mono-space font like Courier New. There is no specific <tab></tab> like tags in HTML. Don't ask me why.

Place "<textarea> etc" in between the

 tags.

With all due respect to the above answers, just placing &#9 will not work as HTML will replace it with a space unless it's in-between the PRE tags.

Solution 4 - Html Entities

The simple and easy answer is including in CSS.

white-space: pre;

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSensefulView Question on Stackoverflow
Solution 1 - Html Entities700 SoftwareView Answer on Stackoverflow
Solution 2 - Html Entitiesshyammakwana.meView Answer on Stackoverflow
Solution 3 - Html EntitiesFandango68View Answer on Stackoverflow
Solution 4 - Html EntitiesAmir hossein KarimiView Answer on Stackoverflow