Firefox and retrieving height set to "auto"

P

Piotr K

Hi,

I've encountered a strange problem with Firefox which I don't have any
idea how to resolve. To the point: I've <div> element with a style
"height: auto" and I want to retrieve this value ("auto") in
JavaScript - however instead of getting "auto" value, I get calculated
height. In IE and Opera it simply returns "auto".

Any ideas how to check in Firefox if element height was set to
"auto" ? I'll be grateful for any help.

Thanks,
Piotr
 
M

Martin Honnen

Piotr said:
I've encountered a strange problem with Firefox which I don't have any
idea how to resolve. To the point: I've <div> element with a style
"height: auto" and I want to retrieve this value ("auto") in
JavaScript - however instead of getting "auto" value, I get calculated
height. In IE and Opera it simply returns "auto".

I think you need to provide a code sample, in this example
<http://home.arcor.de/martin.honnen/javascript/2007/07/test2007072101.html>
Firefox outputs "style.height: auto" for me.
 
D

David Mark

Hi,

I've encountered a strange problem with Firefox which I don't have any
idea how to resolve. To the point: I've <div> element with a style
"height: auto" and I want to retrieve this value ("auto") in
JavaScript - however instead of getting "auto" value, I get calculated
height. In IE and Opera it simply returns "auto".

Any ideas how to check in Firefox if element height was set to
"auto" ? I'll be grateful for any help.

It depends on how you set and retrieve it. I assume you are
retrieving the computed style of a statically positioned element. In
that case you will have to put up with whatever the browser decides to
return. The various browsers often disagree on computed styles. As I
recall, Opera will add the border dimensions in some cases, which is
just wrong.

I can't understand why you would want to retrieve the value of "auto"
as it is the least informative result. What are you trying to
accomplish?
 
P

Piotr K

It depends on how you set and retrieve it. I assume you are
retrieving the computed style of a statically positioned element. In
that case you will have to put up with whatever the browser decides to
return. The various browsers often disagree on computed styles. As I
recall, Opera will add the border dimensions in some cases, which is
just wrong.

I can't understand why you would want to retrieve the value of "auto"
as it is the least informative result. What are you trying to
accomplish?

What I try to do, is setting the same height value for two elements.
If first element has "height: auto", then second must also have
"height: auto". Why? Because in FF element with fixed height won't
adjust height to it's content, while IE will (and I can't set display:
table for FF).
 
D

David Mark

What I try to do, is setting the same height value for two elements.
If first element has "height: auto", then second must also have
"height: auto". Why? Because in FF element with fixed height won't
adjust height to it's content,

It isn't supposed to.
while IE will (and I can't set display:

In quirks mode I think.

I still don't understand the problem exactly. But you are stuck
unless you use inline style (as in the previously posted example.)
What is it that you are trying to write?
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top