hey all, as far as i know there are only 2 child selector bugs in ie7, the comment bug (who found that, your css must be a little obscure if you're sticking comments in between selector IMHO, but whatever) and another one even more obscure. despite that fact, this simple css/xhtml isnt working for me in ie7 and it is in ff. so i imagine ive overlooked something simple and im just not seeing it. would love some help: <html> <body> <style> * {margin:0;padding:0} #notice { position:absolute; width: 100%; left:0; top:0; background-color: #eee; border-top: 1px solid #c0c0c0; border-bottom: 1px solid #c0c0c0; margin-top:7px; /*visibility:hidden;*/ } #notice > div { border-top: 1px solid #d0d0d0; border-bottom: 1px solid #d0d0d0; padding: 3px 0; text-align: center; font-weight:bold; color: #999; } </style> <div id="notice"> <div> message </div> </div> </body> </html> it looks like ie7 just forgets entirely about the #notice > div selection. a quick fix is to change it to #notice div with a global selector, although thats not what i want, i want to know why the simple child selector isnt working...
The problem lies on the very first line - when you have just <html> without a preceding doctype, then Internet Explorer versions 6, 7, and 8 will all go into quirks mode and basically just behave like Internet Explorer version 5. While you have just chanced upon the non-functioning of the child selector under this quirks scenario, there are many, many other CSS properties that won't work properly either, when the doctype is missing. That's apart from all the non-standard behaviours of Internet Explorer v6 (and to a lesser extent, v7) even when the doctype is present. And if using a Transitional or Frameset doctype, ensure the DTD's URL is present in the doctype, otherwise they (IE 6-8) then just ignore the doctype and stay in quirks mode. For more info, have a read here: http://alistapart.com/articles/doctype
Just clarifying something in the last post I made, about Internet Explorer's sensitivity to the presence/absence of the DTD's URL in Transitional or Frameset doctypes. That sensitivity applies to html doctypes, but not to xhtml doctypes. More info on MS's take on doctypes here: http://msdn.microsoft.com/en-us/library/ms535242.aspx
get rid of that > sign and try it. The doctype is an issue and needs to be added for sure. However, #notice div Code (markup): will apply to any child div of #notice. That should be true even in quirks mode, although you will have other problems. If you don't know how to set the doctype, here is one of the most common: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Code (markup):
indeed FilmFiddler, I had overlooked quirks mode. thats what happens when you test with an on the fly htm file and not properly with my doctyped template file... many thanks!! goliath, as i mentioned in my own post i realised that without the child selector i could achieve something similar, although it wasnt as desirable as direct descendants... thanks though! thanks guys, until next time, take care!