By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Tab Function Needed

P: n/a
Has anyone developed a function that can determine the width of a text
string using a proportional font? I would like to do this in order to
insert a variable number of spaces after the text to simulate a tab.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Dennis M. Marks" <de******@dcsi.net> writes:
Has anyone developed a function that can determine the width of a text
string using a proportional font? I would like to do this in order to
insert a variable number of spaces after the text to simulate a tab.


Before trying that, you should know that multiple spaces in HTML are
collapsed, and even if you use non-breaking spaces (which don't
collapse either) or a CSS whitespace setting that prevents it, you
can't aim precisely with spaces. Your "tabs" won't be aligned, because
you can only add an integer multiplum of the width of a space.

I would try to find another way of implementing "tabs".
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
swp
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<fz**********@hotpop.com>...
"Dennis M. Marks" <de******@dcsi.net> writes:
Has anyone developed a function that can determine the width of a text
string using a proportional font? I would like to do this in order to
insert a variable number of spaces after the text to simulate a tab.


Before trying that, you should know that multiple spaces in HTML are
collapsed, and even if you use non-breaking spaces (which don't
collapse either) or a CSS whitespace setting that prevents it, you
can't aim precisely with spaces. Your "tabs" won't be aligned, because
you can only add an integer multiplum of the width of a space.

I would try to find another way of implementing "tabs".
/L


perhaps I am misunderstanding what you are trying to do, but wouldn't
it be very easy to simulate this with a table that has borders turned
off?

swp
Jul 20 '05 #3

P: n/a
In article <fz**********@hotpop.com>, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
"Dennis M. Marks" <de******@dcsi.net> writes:
Has anyone developed a function that can determine the width of a text
string using a proportional font? I would like to do this in order to
insert a variable number of spaces after the text to simulate a tab.


Before trying that, you should know that multiple spaces in HTML are
collapsed, and even if you use non-breaking spaces (which don't
collapse either) or a CSS whitespace setting that prevents it, you
can't aim precisely with spaces. Your "tabs" won't be aligned, because
you can only add an integer multiplum of the width of a space.

I would try to find another way of implementing "tabs".
/L


I was able to do it using monospace fonts but I don't like the look of
the font. Can someone recommend the monospace font to use that would
look better?

http:www.dcs-chico.com/~denmarks/amtrak.html

There is a "tab" between the train name and station names in the first
select box.

P.S. It would still be nice to have a way to do it with proportional
fonts.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #4

P: n/a
Dennis M. Marks wrote:
I was able to do it using monospace fonts but I don't like the look of
the font. Can someone recommend the monospace font to use that would
look better?
Use "Courier New" as first alternative. But the font renders very
small here anyway. And you should try not to use `px' but `em'.
Unfortunately, IE is unable to scale content formatted with font-size:...px;
There is a "tab" between the train name and station names in the first
select box.
There is nothing, not even a list if JavaScript is disabled or not
supported.
P.S. It would still be nice to have a way to do it with proportional
fonts.


Why don't you use a table? You *have* tabular data here. Use the
first column of the table as container for a group of radio buttons,
the second for the train name and the third for the description.
With a server-side application to process the selected train on submit,
you could accomplish this to be suitable for users with and without
client-side JavaScript support.
PointedEars
Jul 20 '05 #5

P: n/a
In article <a5*************************@posting.google.com> , swp
<DS******@aol.com> wrote:
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message
news:<fz**********@hotpop.com>...
"Dennis M. Marks" <de******@dcsi.net> writes:
Has anyone developed a function that can determine the width of a text
string using a proportional font? I would like to do this in order to
insert a variable number of spaces after the text to simulate a tab.


Before trying that, you should know that multiple spaces in HTML are
collapsed, and even if you use non-breaking spaces (which don't
collapse either) or a CSS whitespace setting that prevents it, you
can't aim precisely with spaces. Your "tabs" won't be aligned, because
you can only add an integer multiplum of the width of a space.

I would try to find another way of implementing "tabs".
/L


perhaps I am misunderstanding what you are trying to do, but wouldn't
it be very easy to simulate this with a table that has borders turned
off?

swp


I have a <form><select><option> list. The selection list contains train
name followed by first/last station. I wanted the latter to be tabbed
from the first. I was able to do it with a monospace font. See
http://www.dcs-chico.com/~denmarks/amtrak.com
I thought it would be nice to use a proportional font.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.