IE support for attribute selectors with HTML5 doctype

这一生的挚爱 提交于 2019-12-02 11:27:47

问题


w3school's chapter on attribute selectors states that:

IE7 and IE8 support attribute selectors only if a !DOCTYPE is specified.

IE7 and IE8 don't recognize the HTML5 doctype, right?

So, does this mean that IE7 and IE8 won't recognize my attribute selectors if I use the HTML5 doctype?


回答1:


Your attribute selectors will still work.

Although IE7 and IE8 don't understand that the HTML5 doctype means the document is HTML5, it by itself is still a doctype declaration, and they understand the syntax in general, so they will still render your page in standards mode.

As long as you have some kind of doctype declaration in place, IE will (do its best to) render your page in standards mode, including supporting whatever CSS it supports.




回答2:


Note they aren't stating the HTML5 doctype but state it requires a doctype, though poorly worded. All new web pages are required to have a doctype so the point is moot. Use the HTML5 doctype because it puts all browsers into standards mode where you want to be.

As far as CSS goes, it's more important to know which properties the browser supports in the first place.



来源:https://stackoverflow.com/questions/7801470/ie-support-for-attribute-selectors-with-html5-doctype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!