css - IE 7 / Quirks Mode and Background color? -


this going vague , obscure question, due fact using ie web developer, have no idea going on.

i have utility working on. it's javascript, , has small floating div user interface shows on page. far, standard stuff. problem background color of divs in ui. colors assigned css, , (tired refrain:) looks fine in firefox, chrome, , opera, of course ie being difficult.

the background not show in ie in quirks mode or ie7 mode, in ie8 mode. life of me, can't seem figure out why ie7 isn't showing background.

the page can see offending code here: log hound demo. floating div in upper-right-hand corner - click "v" open up.

looking @ page in ie , in [any other browser on planet] show missing background colors enough. swear, lynx renders better... ahem. offending div ids lhplatehead, lhplatectrlpanel,lhplatetagpanel - easy find firebug @ least. should heeding .lhplatecolor class background color of #dfeaf8, color never applied.

with ie web developer up, tried removing css classes , re-adding them. tried every combination of browser , document mode - again, ie8 browser mode in ie8 document mode had background colors working.

if bored enough take , figure out, i'd obliged.

well - figured out, , far i'm concerned, reason ie suck.

the circumstances of problem are:

  1. you creating element programatically:
    myelmt = document.createelement('div')
  2. you setting styles of element programatically:
    myelmt.setattribute('class', 'myclass');
  3. you adding element programatically dom:
    body.appendchild(myelmt);
  4. you using ie.
  5. ie hates you.

in cases such this, ie8 honour "myclass" css , style element when added dom. ie7 , i'm guessing below blow off css styling , leave thinking employment @ mcdonald's whole lot less stressful.

to recap impatient:

works in ie8 , every other browser on planet

var myelmt= document.createelement('div'); myelmt.setattribute('class', 'myclass'); body.appendchild(myelmt); 

works in ie7 , below:

var myelmt= document.createelement('div'); var attr = document.createattribute('class'); attr.value = 'myclass'; myelmt.setattributenode(attr); body.appendchild(myelmt); 

if can expound on why problem ie7, feel free revel in minutiae. otherwise, remember it's fun , games until loses object reference.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -