How do I replicate a \t tab space in HTML?

后端 未结 8 2123
失恋的感觉
失恋的感觉 2021-01-01 12:08

How can I use the common \\t escape character in html ? Is it possible?

I need a code that has the same function as the /t escape character

8条回答
  •  Happy的楠姐
    2021-01-01 12:33

    HTML doesn't have escape characters (as it doesn't use escape-semantics for reserved characters, instead you use SGML entities: &, <, > and ").

    SGML does not have a named-entity for the tab character as it exists in most character sets (i.e. 0x09 in ASCII and UTF-8), rendering it completely unnecessary (i.e. simply press the Tab key on your keyboard). If you're working with code that generates HTML (e.g. a server-side application, e.g. ASP.NET, PHP or Perl, then you might need to escape it then, but only because the server-side language demands it - it has nothing to do with HTML, like so:

    echo "
    \t\tTABS!\t\t
    ";

    But, you can use SGML entities to represent any ISO-8859-1 character by hexadecimal value, e.g. for a tab character.

提交回复
热议问题