Forum Moderators: open

Message Too Old, No Replies

Cross browser CSS properties

cross browser css properties javascript

         

Dabrowski

8:41 pm on Mar 31, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi kids!

I was hoping someone could help me out with a little JS/CSS issue.

In IE, you use obj.currentStyle.property, in FF you use ...getComputedStyle..... etc....

With an element that has height/width set as a %age, IE reports xx%, whereas FF reports?px as in, the actual area on screen.

What I require is the xx% value as I wrote in CSS, not what FF thinks it actually is, does anyone know a way of reporting the CSS value in FF?

Fotiman

3:38 pm on Apr 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe you could get the width/height of the node's parent as well, and then calculate the percentage yourself? For example, if Firefox says that your node is 100px, and that node's parent is 200px, then 100/200 = .5 or 50%.

Dabrowski

9:35 pm on Apr 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply.

The point is I want to act on elements that have a % specified width. I could calculate the %age but that's not what I want.

Fotiman

2:40 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ok, so you don't actually care what that percentage value is... you just want to find those elements that have a percentage value specified in the CSS?

Dabrowski

4:35 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. Then I do actually need to know what the %age is.