Converting widths to percentage

C

chengiz

Hi,
A web page I regularly visit has a bad stylesheet: especially what
ticks me is hardcoded width settings due to which I cant read without
horizontal scroll at a decent font size. What I'm trying to do is
write a greasemonkey script to change all widths to be percentages.

The problem I'm facing is that only a few elements have the "width"
property in their style (js object -> style -> width). A majority have
empty width there, but their *CSS style* (not just the computed style)
shows up as having a hardcoded width - which I'm unable to get at in
the script. I dont understand how this is possible. Can someone
enlighten me, and help me in getting those widths converted? Many
thanks!

Khan
 
T

Thomas 'PointedEars' Lahn

A web page I regularly visit has a bad stylesheet: especially what
ticks me is hardcoded width settings due to which I cant read without
horizontal scroll at a decent font size. What I'm trying to do is
write a greasemonkey script to change all widths to be percentages.

The problem I'm facing is that only a few elements have the "width"
property in their style (js object -> style -> width). A majority have
empty width there, but their *CSS style* (not just the computed style)
shows up as having a hardcoded width - which I'm unable to get at in
the script. I dont understand how this is possible. [...]

There is o.style.width, document.defaultView.getComputedStyle(o,
null).getPropertyValue("width"), and o.offsetWidth which is the width
actually used for rendering. If you post the URL of the "web page" and the
relevant parts of your code, we will see what we can do.


PointedEars
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top