Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2795
  • Last Modified:

Equivalent of 'TAB' in HTML

Is there any tag in HTML to represent a tab?. I don't wish to specify &nbsp 8 times. (Assuming user has set tab = 8 spaces)
0
prashant_n_mhatre
Asked:
prashant_n_mhatre
  • 3
  • 2
  • 2
  • +2
1 Solution
 
a.marshCommented:
Not that I know of.

Have you perhaps considered using the <pre></pre> tags? Not that I like to use them myself.

Compare:

<p>        Eight spaces before and after.        </p>
<pre>        Eight spaces before and after.        </pre>



:o)

Ant
0
 
COBOLdinosaurCommented:
No but if there are multiple spaces you can preserve them without &nbsp; by enclosing the text in <pre> </pre> which will retain the formatting

Cd&
0
 
COBOLdinosaurCommented:
Sorry ant, didn't see your post.

Cd&
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
a.marshCommented:
There are lots of other ways you can use to get the same effect. One common way is to use a transparent gif and resize it accordingly to "indent" text.

Ant
0
 
a.marshCommented:
Just pipped you there! :oP

Great minds and all that!

:o)

Ant
0
 
prashant_n_mhatreAuthor Commented:
Thank you all!!!
I know <pre> and I use the same instead of &nbsp. Actually I was wondering if html supports some keyword that does the same job.
0
 
coreytiCommented:
What about CSS guys???

----------
<html>
<head>
     <title>nothing to see here</title>
     <style type="text/css">
          .tabOne {
               text-indent: 40pt;
          }
     </style>
</head>

<body>
<p class="tabOne">
     Here is a paragraph with one tab<br>
     on the leading line. Every subsequent<br>
     line is leftmost.
</p>
</body>
</html>
----------

Change the pt size to suit your tastes (can also be px, em, ex, or %).

-corey
0
 
webwomanCommented:
The one problem I see with this is that if you're just using it to indent the first line of a paragraph it's unnecessary -- there's space after a paragraph by default, and the typography standard is either first line indent OR space after... even for print. ;-)

CSS would work, provided the browser supports that attribute. Some don't, and you can get some strange things happening in older browsers that don't have good CSS support.

If you're using it to align multiple columns, use a table. Not that the pre tag won't work, mind you. And if you're getting this text from a file that doesn't translate well into tables, pre is the easiest way to go -- in theory it would be better to put it into tables, but if you've got 20 pages of data from a report and some of the cells are multi-line entries but the data is in txt format and there are returns between them... pre works just fine. At least you can get the page done in this lifetime.. (I live in the real world too) ;-)
0
 
prashant_n_mhatreAuthor Commented:
Thank you all. Yeah...CSS seems to be a better idea.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now