Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

How do I compensate for font size?
 

George Hester




quote this post edit post

IP Loged report this post

Old Post  07-27-04 - 04:16 AM  
I have this in a html <div id=3D"fltUp" align=3D"center"><font =
size=3D"3+" id=3D"fntStop">Howdy</font></div>

Now in JavaScript I can read fltUp.innerText.length.  But if the size of =
the font changes fltUp.innerText.length does not.  How can I compensate =
the width of Howdy when the font size changes?  Thanks.

--=20
George Hester
__________________________________


Post Follow-Up to this message ]
Re: How do I compensate for font size?
 

Harlan Messinger




quote this post edit post

IP Loged report this post

Old Post  07-27-04 - 04:16 AM  
"George Hester" <hesterloli@hotmail.com> wrote:

>I have this in a html <div id="fltUp" align="center"><font size="3+" id="fntStop">H
owdy</font></div>

"3+"?

>
>Now in JavaScript I can read fltUp.innerText.length.  But if the size of the font c
hanges fltUp.innerText.length does not.

Of course not. Why would the number of characters change when the font
does?

>How can I compensate the width of Howdy when the font size changes?  Thanks.[/color
]

What do you mean by "compensate"?

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.


Post Follow-Up to this message ]
Re: How do I compensate for font size?
 

Ivo




quote this post edit post

IP Loged report this post

Old Post  07-27-04 - 04:16 AM  
> "George Hester" wrote
> I have this in a html
> <div id="fltUp" align="center">
> <font size="3+" id="fntStop">Howdy</font>
> </div>
>
> Now in JavaScript I can read fltUp.innerText.length.  But if
> the size of the font changes fltUp.innerText.length does not.
> How can I compensate the width of Howdy when the font
> size changes?  Thanks.

Not sure about the + sign in the sizefont tag. Also not sure what you want
to compensate. fltUp.innerText.length will give the number of characters (in
some environments) but width depends on much much more. For that you could
(in some environments) read

document.getElementById('fltUp').offsetWidth

which will give you the width of the element in pixels.
It may turn out the div is as wide as the window. Then read the width the
font tag itself. The font tag is deprecated by the way. Use a span.

And post in plain text format please.
Thanks,
Ivo




Post Follow-Up to this message ]
Re: How do I compensate for font size?
 

Brian




quote this post edit post

IP Loged report this post

Old Post  07-27-04 - 09:16 AM  
George Hester wrote:

> <div id="fltUp" align="center"><font
> size="3+" id="fntStop">Howdy</font></div>
>
> Now in JavaScript I can read fltUp.innerText.length.  But if the
> size of the font changes fltUp.innerText.length does not.  How can
> I compensate the width of Howdy when the font size changes?

"The font size chosen by the user as a comfortable default (1 em)
provides more truly useful information about the rendering environment
than all the resolution-sniffing, window-querying, 'open-this-wide'
logic you can throw at the problem."

- Todd Fahrner

In other words, use css and the em unit to size what you need to size.
No js needed.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/


Post Follow-Up to this message ]
Re: How do I compensate for font size?
 

George Hester




quote this post edit post

IP Loged report this post

Old Post  07-31-04 - 12:16 AM  
catch the true width.  I did it of sorts.  Put the size in a pixel the =
font could represent then use a scaling factor.

--=20
George Hester
__________________________________
"Harlan Messinger" <hmessinger.removethis@comcast.net> wrote in message =
news:8ndbg01tuqb3qb5ajm8q4qoivid34bl4l1@4ax.com...
> "George Hester" <hesterloli@hotmail.com> wrote:
>=20 
size=3D"3+" id=3D"fntStop">Howdy</font></div>
>=20
> "3+"?
>=20 
of the font changes fltUp.innerText.length does not. =20
>=20
> Of course not. Why would the number of characters change when the font
> does?
>=20 
Thanks.
>=20
> What do you mean by "compensate"?
>=20
> --=20
> Harlan Messinger
> Remove the first dot from my e-mail address.
> Veuillez =F4ter le premier point de mon adresse de courriel.


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 03:11 PM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top