HTML5+CSS3网站能在IE8浏览器正常显示的方法

2015-11-12 admin 评论:0

璧峰垵锛孖E鍏跺疄涔熸槸涓€娆鹃潪甯告湁杩涘彇蹇冪殑娴忚�堝櫒銆備絾缁忚繃涓€娈垫椂闂寸殑铔颁紡鍚庯紝瀹冨凡缁忔垚涓轰簡鎴戜滑鐢熸椿涓�鐨勪竴閬撻殰纰嶃€傚井杞�鐜板湪鍙堥噸鏂板紑濮嬪悜鍏跺畠娴忚�堝櫒鍙戣捣鎸� 鎴橈紝浣嗕簨瀹炴儏鍐垫槸锛屾柊鐗堢殑鐜颁唬IE娴忚�堝櫒涓€鐩存粸鍚庝簬璋锋瓕娴忚�堝櫒鍜岀伀鐙愭祻瑙堝櫒銆傛垜浠�杩樹笉寰椾笉鎯冲姙娉曞吋瀹规棭鏈熺殑IE娴忚�堝櫒銆備笅闈㈡彁鍒扮殑涓夌�嶆柟娉曡兘蹇�鎹疯交鏉剧殑璁� 浣犵殑HTML5&CSS3缃戠珯鍦ㄥ井杞�鐨勪富瑕佹祻瑙堝櫒涓�涔熻兘绁炲�囩殑杩愯�岋紒

<font size=“5”><font size=“3”>htmlshiv.js</font></font>

Remy寮€鍙戠殑HTML5shiv宸ュ叿鑳藉埄鐢↗avaScript鍦ㄨ€佸紡IE閲屽垱寤簃ain锛宧eader锛宖ooter绛塇TML5鍏冪礌銆備篃灏辨槸 璇翠娇鐢↗avaScript鑳藉垱寤鸿繖浜涙湰鏉ヤ笉瀛樺湪鐨凥TML5鏂板厓绱犮€傝繖鏄�浠€涔堝師鐞嗭紵浣犲彲鑳借姳鍑犲ぉ涔熸兂涓嶆槑鐧斤紝浣嗚皝鍦ㄦ剰鍛�锛佽繖涓�鑴氭湰鍑犱箮鏄�鎵€鏈夋�e紡缃戠珯蹇� 鐢ㄧ殑js銆�

<pre data-role=“code” class=“brush: css;toolbar:false;”><!–[if lt IE 9]> <script src=“dist/html5shiv.js”></script> <![endif]–></pre>

<font size=“5”><font size=“3”>selectivizr.js</font></font>

Selectivizr.js鏄�涓€娆剧�炲�囩殑宸ュ叿锛屽畠鑳芥彁渚涘ぇ閲廔E涓嶆敮鎸佺殑CSS閫夋嫨鍣ㄥ拰灞炴€э紝鍖呮嫭鎵€鏈夌殑last-child閫夋嫨鍣ㄣ€傛渶杩戝湪缃戠珯鏀圭増杩囩▼涓�锛屾垜浣跨敤浜唖electivizr锛岀綉绔欑珶鐒跺彲浠ユ��涓嶈蛋鏍风殑鍦ㄨ€佸紡IE娴忚�堝櫒鐨勬�e父鏄剧ず銆備笅闈㈡槸鎴戜娇鐢ㄧ殑浠g爜鐗囨�碉細

<pre data-role=“code” class=“brush: css;toolbar:false;”><!–[if lte IE 8]><script src=“js/libs/selectivizr.js”></script><![endif]–></pre>

鐜颁唬鏂版妧鏈疻EB椤圭洰涓嶅彲缂哄皯鐨刯s搴撱€傚畠鍙�浼氬湪鑰佸紡IE閲屽姞杞姐€�

<font size=“5”><font size=“3”><html>鏉′欢鍒ゆ柇娉ㄩ噴</font></font>

浣犱竴瀹氳�佸埌杩囪繖绉嶆瀬鍏朵笐闄嬬殑鏉′欢鍒ゆ柇娉ㄩ噴銆傜劧鑰岋紝涓戣櫧涓戯紝瀹冨嵈鑳借�╀綘鐨勭綉椤佃兘鎸変綘甯屾湜鐨勬柟寮忚繍琛岋細

<pre data-role=“code” class=“brush: html;toolbar:false;”><!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]–></pre>

杩欐�典唬鐮佷笉闇€瑕丣avaScript锛屼笉闇€瑕佺瓑寰匤avaScript鐨勫姞杞斤紝浣犲畾涔夌殑CSS鏍峰紡浼氱珛鍗崇敓鏁堣捣浣滅敤锛屾病鏈夐偅绉嶅洜涓哄姞杞藉欢杩熻€屽嚭鐜扮殑鏍峰紡闂�鍙樸€�

铏界劧IE鍦ㄥ�嬭捣鐩磋拷瀹冪殑閭d簺绔炰簤瀵规墜锛屼絾鐜板疄鎯呭喌鏄�鑰佸紡鐨処E娴忚�堝櫒浠嶇劧鐩稿綋鏅�閬嶏紝鐗瑰埆鏄�鍦ㄩ偅浜涘彂灞曚腑鍥藉�躲€傛�f叞鐨勬槸锛屼笂闈㈢殑杩欎簺宸ュ叿鍦ㄦ墍鏈夋祻瑙堝櫒閲岄兘鍙�浠ヤ娇鐢ㄣ€�

评论
回到顶部