<div question, getting fixed size of contents, not just character count

<div question, getting fixed size of contents, not just character count

am 26.08.2007 00:59:50 von lhjayunaz

hi, is it possible in anyway, to read or determine absolute pixel
width size of contents within a

tag?

so like
what is pixel wXX size of this text?
:-) :-)

Re: <div question, getting fixed size of contents, not just character count

am 26.08.2007 14:16:50 von Neredbojias

Well bust mah britches and call me cheeky, on Sat, 25 Aug 2007 22:59:50 GMT
scribed:

> hi, is it possible in anyway, to read or determine absolute pixel
> width size of contents within a

tag?

-Of bare text? I think you'd need a container of some sort. Then it's
possible.

> so like
what is pixel wXX size of this text?
:-) :-)

Position the div absolutely.

--
Neredbojias
Half lies are worth twice as much as whole lies.

Re: <div question, getting fixed size of contents, not just charactercount

am 26.08.2007 19:45:55 von jmm-list-gn

lhjayunaz@gmail.com wrote:
> hi, is it possible in any way, to read or determine absolute pixel
> width size of contents within a

tag?
>
> so like
what is pixel wXX size of this text?

>
For HTML, no.
It would have to be a client-side function since a div normally expands
to the width of its container. If it is floated, then it shrinkwraps the
text, probably. In either case it depends on the client's current setup:
the width of the viewport, the metrics of the font set.
What is your application that needs to know this information?

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Re: <div question, getting fixed size of contents, not just character count

am 26.08.2007 23:58:34 von Martin Jay

On Sat, 25 Aug 2007 22:59:50 -0000, lhjayunaz@gmail.com wrote:

>hi, is it possible in anyway, to read or determine absolute pixel
>width size of contents within a

tag?
>
>so like
what is pixel wXX size of this text?
:-) :-)

There is a discussion about this here:
.

The fifth message in the thread may be of interest to you.

As I understand it, it's only possible to get the width of a DIV using
Javascript in IE (<7?) if it has been specifically set using CSS. In
which case you'd probably know it already.

I've uploaded a simplified page using the method described to
.

Try loading the page into Firefox, Opera or Safari and then hitting
the refresh button in the browser.

As usual IE, versions less then 7 anyway, is the odd man out.
--
Martin Jay