Why isn't :nth-child working in IE9?

前端 未结 5 2023
野趣味
野趣味 2020-12-10 03:57

According to this page, :nth-child should work in IE9, and I have tried it before and it worked fine, but on this page, it does not appear to be working. View the page in Ch

相关标签:
5条回答
  • 2020-12-10 04:26

    <!DOCTYPE html> won't stop quirk mode, <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> does.

    0 讨论(0)
  • 2020-12-10 04:47

    They look the same here. You sure you're not in compatibility mode?

    0 讨论(0)
  • 2020-12-10 04:47

    My version of IE9 was locked into IE8 rendering mode, which wasn't applying the following selector:

     .parentClass > div:nth-child(n+2) .childClass
    

    Here is where you can find the options to change it:

    Where in IE9 to Adjust Browser and Document mode

    0 讨论(0)
  • 2020-12-10 04:49

    For some reason I cannot fathom, IE9 defaults to compatibility mode for looking at intranet sites, or an HTML page stored as a file on a PC. Compatibility mode means 'render stuff like a dumb old browser'. This means that when you're designing stuff for a website and you try to preview from your favourite IDE in IE9, none of the CSS3 stuff works. You have to click on Tools ->' compatibility view settings' in the IE9 menu and then unclick the pesky checkbox that says 'display interanet sites in compatibility view'. From then on the wretched browser works like any sane browser such as Safari. Why did they do it? Heaven only knows, but it has taken me ages to discover this simple fix due to the fact that I kept blaming my code.

    0 讨论(0)
  • 2020-12-10 04:53

    It appears to be working for me.IE9

    Chrome

    0 讨论(0)
提交回复
热议问题