0

I'm trying to get the same behavior as a \t in html. How can I get that?

Like when I have \r\n, I'm using <br/>. What about \t?

Thanks,

Mike.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
  • 2
    Possibly answered here already: http://stackoverflow.com/questions/9660987/how-to-get-a-tab-character – momar Apr 20 '16 at 15:23
  • There is no concept of tabs in html. Use [css or tables](http://webdesign.about.com/od/intermediatetutorials/qt/tiphtmltab.htm) for column layout. – Tim Schmelter Apr 20 '16 at 15:25
  • Possible duplicate of [HTML: Tab space instead of multiple non-breaking spaces ("nbsp")?](http://stackoverflow.com/questions/1571648/html-tab-space-instead-of-multiple-non-breaking-spaces-nbsp) – docksteaderluke Apr 20 '16 at 17:41

2 Answers2

0

For a tab, you can use &#9; in a <pre></pre> tag

Mike Turner
  • 471
  • 1
  • 7
  • 22
  • What about a \n tag? What's the equivalent of that? –  Apr 20 '16 at 16:02
  • 2
    [tab](http://www.amp-what.com/unicode/search/tab) [newline](http://www.amp-what.com/unicode/search/newline) - you can search html entities by keyword at http://www.amp-what.com/ – alexanderbird Apr 20 '16 at 17:44
  • 1
    This is also inserting a newline. How can I do without that? I need a tab to line things up without a new line. –  Apr 20 '16 at 18:30
0

Another approach is to use css to space it out.

.tabbed {
  padding-left: 4em;
}
This is a sentence up to the <span class="tabbed">tabbed part</span>
<br/>This is a bigger sentence up to the <span class="tabbed">tabbed part</span>
<br/>

.. but that doesn't line things up, it just puts in a gap - as shown by the two sentences of different lengths in the code snippet.

But, if you are looking for a tab solution that allows you to have multiple columns of text all lined up, you probably should use a table instead of simulating a table with tabs.

alexanderbird
  • 3,847
  • 1
  • 26
  • 35