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

后端 未结 8 2088
失恋的感觉
失恋的感觉 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条回答
  • 2021-01-01 12:33

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

    What function do you mean, creating a tabulator space?

    No such thing in HTML, you'll have to use HTML elements for that. (A <table> may make sense for tabular data, or a description list <dl> for definitions.)

    0 讨论(0)
  • 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: &amp;, &lt;, &gt; and &quot;).

    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 "<pre>\t\tTABS!\t\t</pre>";
    

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

    0 讨论(0)
  • 2021-01-01 12:36

    You must use

    <dd> </dd> in the html code.

    <dd>A free, open source, cross-platform,graphical web browser developed by theMozilla Corporation and hundreds of volunteers.</dd>
    
    ----------------------------------
    Firefox
        A free, open source, cross-platform, graphical web browser developed by the Mozilla 
        Corporation and hundreds of volunteers.
    

    enter image description here

    0 讨论(0)
  • 2021-01-01 12:48

    &nbsp;&nbsp;&nbsp;&nbsp; would be a work around if you're only after the spacing.

    0 讨论(0)
  • 2021-01-01 12:53

    You can use this &emsp; or &ensp;

    It works on Visual Studio

    0 讨论(0)
  • 2021-01-01 12:57

    This simple formula should work. Give the element whose text will contain a tab the following CSS property: white-space:pre. Otherwise your html may not render tabs at all. Then, wherever you want to have a tab in your text, type &#9;.

    Since you didn't mention CSS, if you want to do this without a CSS file, just use

    <tag-name style="white-space:pre">text in element&#9;more text</tag-name>
    

    in your HTML.

    0 讨论(0)
提交回复
热议问题