Then I tried to make the CSS rule important and it didn't work. The
positioning was all wrong in Safari and very jerky in Firefox.
Am I doing this correctly?
Still no good in Safari when the rule is inserted with !important. It
is the same behavior as if I do not insert the rule at all: the
positioning is all wrong. If the rule is defined in a stylesheet file
then !important doesn't cause any problems.
I was wrong, it is not jerky in Firefox. I had to restart firefox for
other reasons and now it is ok. However, when I look in the DOM
inspector the rule shows up as relative but not as important. If I
hardcode the style into my HTML document in the element's style tag,
then the Firefox DOM inspector shows that the rule is important. Hmmmm
> Then I tried to make the CSS rule important and it didn't work. [...]
> element.style.position="relative !important";
> Am I doing this correctly?
No. The assigned string should only contain the declaration value.
To set a priority, call the setProperty method, but this should not be
necessary. In-line style declarations are the most specific possible,
and will take precedence unless there is an !important declaration
Prefix subject with [News] before replying by e-mail.