473,394 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

element.style.position="relative !important";

Hi,

I tried the following and everything worked fine.

element.style.position="relative";

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.

element.style.position="relative !important";

Am I doing this correctly?

Thanks,
Peter

Mar 18 '06 #1
2 5037
Hi,

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

Is JavaScript support for inserting !important rules just not ready
yet?

Peter

Mar 18 '06 #2
On 18/03/2006 20:49, pe**********@gmail.com wrote:

[snip]
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
elsewhere.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Mar 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jamie Jackson | last post by:
I'm trying to limit the space between an <h1> and an <h2>, which immediately follows. Isn't there some syntax for this? <h1>Main Header</h1> <h2>Sub Header</h2> There's too much space between...
3
by: Greg G | last post by:
We have a band web site. Here's the site now: http://www.risky-biz.com The home page has a "collage" of photos of the members of the band. The collage is actually one .gif image that I put...
15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
2
by: Dag Sunde | last post by:
I have the following function to resize a div element (Content) depending on the size of another div element (leftConent). function adjustContentHeight() { var content =...
5
by: balakrishnan.dinesh | last post by:
hi Frnds, I need Confirm box with "yes" or "no" buttons, Is that possible in JAVASCRIPT , Can anyone tell me the solution for this or anyother way to create confirm box with "yes" or "no" button?...
3
by: rsrimantula | last post by:
I have a table with html code <style> div.scroll { height:150px; overflow:auto; } table.scrollable th { position:relative;
4
by: john | last post by:
Hi to All, I am new to html authoring, so sorry if my terminology is not correct or exact. I would like to position a footer div to the bottom of the browser window. As I research in the web...
15
by: pbd22 | last post by:
Hi. I want to create a tab with a little "active tab" arrow below it to tell the user where they are. An example is here: http://personals.yahoo.com/us/search/dashboard Does anybody know of...
4
by: Julek | last post by:
Hi, I wanted to know, if there is guarantee that a specific variable is always the same number of bytes forward than the beginning of the struct/class. Example: class MyClass { .... int var;...
2
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.