RE: [WSG] !important via script possible?
Thanks for replies on this. I've got this all go in CSS now so don't need to apply !important in my script. Don't have much choice re using !important as have to mix a few things - inline height style on a block, DHTML height adjustments on this, then CSS fixes for that IE 3-pixel jog all on the same block. %&&%#$##$!!! Cheers :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rebecca Cox Sent: Wednesday, 30 March 2005 11:35 a.m. To: wsg@webstandardsgroup.org Subject: [WSG] !important via script possible? I'm pretty sure this isn't possible, but does anyone know if its possible to add the !important declaration to a style set with script, as in: document.getElementById("mydiv").style.height = hvar + "px !important"; Its fine in Gecko but not IE6... Any ideas? ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
RE: [WSG] !important via script possible?
A warning against using the !important declaration as a hack: see http://tantek.com/log/2004/09.html#d07t1434 here's an excerpt: "IE (all platforms) supports !important, just go try the CSS1 Test Suite section 3.1 (http://www.w3.org/Style/CSS/Test/CSS1/current/sec31.htm) important test suite page for yourself. And if you check any of the CSS feature support charts out there, you'd see the same. There is however a kernel of a bug hidden in this tip: margin-top: 3.5em !important; margin-top: 2em So, the top margin will be set to 3.5em for all browsers except IE, which will have a top margin of 2em First, the reported problem only occurs for IE/Windows based browsers (i.e. IE5/Mac handles !important properly, including in this case. Another reason to question the article, as it appears the author doesn't distinguish between IE/Windows and IE/Mac rendering engine behavior, which can be quite different.) Second the problem actually has nothing to do with !important, but with the processing of multiple declarations of the same propertry in the same style rule. Similar problems result in IE/Windows if you try multiple declarations of the 'color' property for example with a CSS1 value followed by a CSS3 Color value that latter user agents support." hope this helps, -Grant Rebecca Cox wrote: > I'm pretty sure this isn't possible, but does anyone know if its > possible to add the !important declaration to a style set with script, [...] > Its fine in Gecko but not IE6... Any ideas? As just mentioned in the reply to another thread, IE ignores !important -- Patrick H. Lauke ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] !important via script possible?
Rebecca Cox wrote: I'm pretty sure this isn't possible, but does anyone know if its possible to add the !important declaration to a style set with script, [...] Its fine in Gecko but not IE6... Any ideas? As just mentioned in the reply to another thread, IE ignores !important -- Patrick H. Lauke _ re·dux (adj.): brought back; returned. used postpositively [latin : re-, re- + dux, leader; see duke.] www.splintered.co.uk | www.photographia.co.uk http://redux.deviantart.com ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] !important via script possible?
I'm pretty sure this isn't possible, but does anyone know if its possible to add the !important declaration to a style set with script, as in: document.getElementById("mydiv").style.height = hvar + "px !important"; When would this ever be necessary? Do you have a test page we could look at? When you set an attribute of the style object, you are essentially declaring a new value that is last in the cascade. It should override anything else that is not set with !important. So if you are finding that you need to use !important in the scripting, I suspect you might find it easier to search back through the CSS and remove those !important declarations that you don't need. That said, you might have better luck using the IE "runtimeStyle" object instead for that browser. -- Ben Curtis : webwright bivia : a personal web studio http://www.bivia.com v: (818) 507-6613 ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
[WSG] !important via script possible?
I'm pretty sure this isn't possible, but does anyone know if its possible to add the !important declaration to a style set with script, as in: document.getElementById("mydiv").style.height = hvar + "px !important"; Its fine in Gecko but not IE6... Any ideas? ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **