2014年6月26日 星期四

舊版 IE 支援 HTML5、CSS3 的幾種方法

 

■ 透過 javascript 支援 HTML 5、CSS 3



使用 Remy 的 HTML5shiv -- htmlshiv.js

利用 JavaScript 在舊版 IE 建立 main、header、footer 等 HTML5 元素(elements)。

<!-​​-[if lt IE 9]>
<script src="dist/html5shiv.js"></script>
<![endif]-->


使用 selectivizr.js 可支援 CSS selectors、properties,例如 last-child

<!--[if lte IE 8]>
<script src="js/libs/selectivizr.js"></script>
<![endif]-->



■ 利用 IE 的條件式註解 <html> Conditional Comments



<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9" lang="en"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->





參考
3 Solutions for Supporting Internet Explorer
http://davidwalsh.name/supporting-internet-explorer

沒有留言:

張貼留言