Forum Moderators: open

Message Too Old, No Replies

Uh... this is a real simple one i'm sure

..just want to insert a TAB in an HTML document

         

mylungsarempty

10:31 am on Dec 1, 2003 (gmt 0)

10+ Year Member



I know there's & n b s p to insert a space, but what would i type if i want a tab?

Distel

10:55 am on Dec 1, 2003 (gmt 0)

10+ Year Member



& # 0 0 9

traffik daddy

12:00 pm on Dec 1, 2003 (gmt 0)

10+ Year Member



Try this link, I use it for all my characters:

[asciitable.com...]

Try out the reaction tests on the site, pretty cool coding.

Enjoy =)

Terry

Shadows Papa

2:50 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



empty lings - I've heard that different broswers can display tabs with different sizes - ie- one browser might allow 5 spaces for a tab while another allows 3, etc. meaning a tab is different for different browsers - thus, it will look different.
Is there a reason one would wish to display a tab rather than maybe defining an indent or using spaces where YOU control how many spaces are displayed?

BTW - I wish to thank drdoc and others for leading me to Firebird. Love it. It's the most trouble-free browser I've ever used, ever.

Shadows Papa

ergophobe

5:54 pm on Dec 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For paragraph indentation and such, I use CSS.

I can't think of a case where I would use tabs instead, but that may be a failure of imagination.


Firebird. Love it. It's the most trouble-free browser I've ever used, ever.

Except that the password manager stinks and is almost making me go back to Mozilla, but I digress...

Tom

alexhudson

6:21 pm on Dec 9, 2003 (gmt 0)

10+ Year Member



I hate to disagree with the original poster, but   doesn't insert a space character - it encodes a non-breaking space, so word-wrap algorithms know not to break sentances at that point.

Presuming the poster wants to "force" a tab-stop, there is no way to in HTML - inserting tabs (' ' the whitespace tab and 	 the character set entity are the same character) will just display like spaces, because in HTML all whitespace is equal unless the text is preformatted. Check it out:


<html>
<body>
<p>This is a tab: &#009;tab&#009;tab&#009;</p>
<pre>
tab&#009;tab&#009; tab
</pre>
</body>
</html>

I can't really think of any way of inserting "real" tabs in HTML, without resorting to Javascript for the layout. If you were after actual tab-stops as you might get in a wordprocessor, you're actually talking about a right margin that is some modulo of the length of the block, and I don't think CSS can handle that. However, I also can't think of a reason you might want it :)

It would be quite interesting to save a doc from a wordprocessing in HTML format and see how it handles real tabstops. I've tried Abiword, and tabs get completely lost.

ergophobe

12:52 am on Dec 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




It would be quite interesting to save a doc from a wordprocessing in HTML format and see how it handles real tabstops.

Hmm.... interesting question.

I put in "[tab]This starts with a tab".

WordPerfect 2000:
Puts in five plain spaces.

Word 2000:
About 50 lines of code. If you open it up in Word, the tab will be preserved, but I can't imagine you would want to put the page on the web. In it's web version, there are only several spaces and severl styles which are Word-specific and set within HTML comments.

Star Office (starting with a text doc):
Puts in five plain spaces.

Tom

ergophobe

12:59 am on Dec 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




right margin that is some modulo of the length of the block

Aren't tabs usually calculated in ems? Chicago has nothing to say about the size of indents and tabs, but I don't think it's usually related to the length of the block, but rather the size of the font, no?

Tom

alexhudson

8:37 am on Dec 10, 2003 (gmt 0)

10+ Year Member



ergophobe: no ;) Look at this:


123456781234567812345678 [(ruler ;)]
fish red
dog brown

Those columns are separated by tab-stops. The whitespace between the columns is a tab; so tell me, how long is a tab?

Well, how long is a piece of string. You actually take the length of the word/block before, divide by the maximum length of your tab, and the remainder is the tab size to use. What value you use for "length" is up to you: number of characters maybe (this would be your ems value), or the actual pixel-length of the word (this is what wordprocessors tend to use, since their fonts don't tend to be monospaced).

And if you think you can make the above tab example in HTML using tables, think of this example:


123456781234567812345678
fish red
dog brown
orangutan orange

Tab-stops don't line up unless the words are roughly the same length. They just put the next word at some position further right. You wouldn't be able to emulate the above with tables. However, as I intimated in my posts, you probably wouldn't want to emulate this behaviour anyway :)

robert adams

3:18 pm on Dec 10, 2003 (gmt 0)

10+ Year Member



I don't know much about how it all works, I just know that people have to remember that html is not a word processor.

robert

ergophobe

7:05 pm on Dec 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Alex,

Got it. I was thinking that the tab stop would be every X em, which may be, but as you explain that doesn't help you at all in terms of doing layout. You need to know the distance between the previous word and the next to know what the offset is to get you to that tab.

Paragraph indention is easy because the offset is always the same.

It's curious that Chicago has lots on indention in indexes, but very little for text and no mention that I could find of tabbing.

Tom

tedster

9:10 pm on Dec 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's been a lot of conversation about including a tab function in CSS, but as far as I know, it has not happened. You can see a lot of correspondence on the idea on the W3C lists. Here's one proposal [lists.w3.org] that goes back to 1996.

IeuanJ

4:15 pm on Dec 17, 2003 (gmt 0)

10+ Year Member



There is no actual tab function but it is east to create the effect of one by using a <span></span> element and setting the size with CSS. Not ideal but it does allow you to control either in exact pixels, measurements or relative ems.

ergophobe

6:52 pm on Dec 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But as Alex points out, that won't really give you the same effect as a tab stop, except maybe if you have a fixed-width font... not sure about that. For that matter, tabs don't work that well even in a word processor if you change fonts, since every font uses space a bit differently.
If I could get [ p r e ] to work as expected, I would show what I mean, but I can't

Tom