You are here:About>Computing & Technology>Web Design / HTML> HTML and XHTML> Intermediate Tutorials> Tabs in HTML: Using the Tab Character in Web Pages
About.comWeb Design / HTML
Newsletters & RSSEmail to a friendSubmit to Digg

Tabs in HTML

From Jennifer Kyrnin,
Your Guide to Web Design / HTML.
FREE Newsletter. Sign Up Now!

Using the Tab Character in Web Pages

Were you looking for help with Tabbed Navigation with HTML?

One of the most confusing things about HTML for a beginning Web designer is the way that white space is handled. In print, the three primary white space characters act in three distinct ways, the space, the tab and the carriage return. But in HTML, browsers render them all exactly the same. If you place 1 space or 100 or mix it up with tabs and carriage returns, they will all be condensed down to 1 space when the page is rendered by the browser.

Then How Do You Get Tabs?

If you're thinking of tabs the way that word processing programs use them, markers along the horizontal axis of the page that text align to, well, the short answer is that you can't. Not exactly.

But typically, when people use tabs in a document, they are using them for layout reasons or to get the text to move over a certain amount. This you can handle in HTML.

Layout

The easiest way to modify layouts in HTML is with CSS. If you're using tabs to create columns of text, you can use div tags that are positioned with CSS to get the same effect. Or if the data is appropriate, you can use tables to align your tabular data as you like.

Moving Text More than One Space

If all you want is for your text to be moved more than one space away from the preceding item, you can use the non-breaking space. To use the non-breaking space, you simply type   as many times as you need it. So if you wanted to space your word 5 spaces over, you would type       and then your word. Note that some really old browsers will still condense non-breaking spaces down to one space, but those browsers are very uncommon now.

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.