Calculating the width of an element

N

Nathan Sokalski

I want to make a table of links on my page. However, because different users
will have different screen widths, I will need to calculate the number of
columns based on the screen width and width of the table's data. How can I
determine, in pixels, the width of a given piece of text? Any help would be
appreciated. Thanks.
 
H

Herfried K. Wagner [MVP]

Nathan Sokalski said:
I want to make a table of links on my page. However, because different
users will have different screen widths, I will need to calculate the
number of columns based on the screen width and width of the table's data.
How can I determine, in pixels, the width of a given piece of text?

This would require a client-side script (VBScript, JScript, JavaScript), if
there is a clean solution at all. However, using client-side scripts
require the user to have scripting enabled.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top