百度貼吧,百度圖片的實現css
<!--[if lt IE 9]> <script> (function(){ var tags = ['header','footer','figure','figcaption','details','summary','hgroup','nav','aside','article','section','mark','abbr','meter','output','progress','time','video','audio','canvas','dialog']; for(var i=tags.length - 1;i>-1;i--){ document.createElement(tags[i]);} })(); </script> <![endif]--> <style> header,footer,section,article,aside,nav,figure{display:block;margin:0;padding:0;border:0;} </style>
騰訊isux研究院的實現html
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
淘寶- 個人淘寶頁實現同上,只不過是不一樣版本html5
<!-- [if lt IE 9]> <script src="http://g.tbcdn.cn//tb/mytaobao/12.12.15/common/??html5shiv-min.js"></script> <![endif]-->
不得不提的一個插件 https://github.com/aFarkas/html5shiv 在github 上達到了3453 星的高度,得到了國內外的普遍承認,若是你厭煩了滿頁面的div 想盡早擁抱html5 元素,就使用它吧。git
關於兼容模式
百度首頁使用的是github
<meta http-equiv=X-UA-Compatible content=IE=EmulateIE7>
百度搜索頁使用的是web
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
百度圖片,騰訊isux研究院,淘寶收藏頁使用的是chrome
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
X-UA-Compatible 這是個是IE8的專用標記,用來指定IE8瀏覽器去模擬某個特定版本的IE瀏覽器的渲染方式
chrome=1寫法能夠達到的效果是若是安裝了GCF,則使用GCF來渲染頁面,若是未安裝GCF,則使用最高版本的IE內核進行渲染。canvas
百度首頁那麼點東西他固然不在意用哪一種模式,更多地去照顧老式瀏覽器; 搜索頁傾向於速度有GCF的時候更願意使用chorme渲染。瀏覽器
不得不吐槽,國內各的銀行支付時的兼容支持,由此第三種獲得你們的共同承認彷佛也無可厚非。app
騰訊isux研究院的實現
<!-- Mobile Specific Metas ================================================== --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes" />
淘寶主頁的實現
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> <meta content="yes" name="apple-mobile-web-app-capable" />
這裏沒貼百度的,不表明百度不重視這一塊,反而過重視了,19億$買了91無線 再加上 百度App 貼吧App 音樂App 圖片APP ... 全有了。
<!--[if lt IE 8]> <div class="g_tips"> <p>已經有超過90%的用戶使用更高版本 <a target="_blank" title="下載Chrome" href="http://www.google.com/chrome/">Google Chrome</a> 或 <a target="_blank" href="http://www.microsoft.com/zh-cn/download/ie.aspx?q=internet+explorer">Internet Explorer</a> 體驗到了更精彩的頁面,你還不試試?</p> </div> <![endif]--> <style> .g_tips{background:#FFF691;color:#010101;text-align:center;height:40px;line-height:40px;font-family:'STHeiti','\5fae\8f6f\96c5\9ed1'}.g_tips a{color:#676767;padding:0 2px;zoom:1} </style>
什麼,連ie8都不是? 沒法容忍啊,建議你早點換吧!
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>頁面名稱</title> <meta name="keywords" content=""/> <meta name="description" content=""/> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <!-- Mobile Specific Metas ================================================== --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes" /> <!-- CSS ================================================== --> <link rel="shortcut icon" href="http://www.yunos.com/favicon.ico"> <link rel="stylesheet" href="http://m.alicdn.com/css/index.css"/> <style>/* css */</style> </head> <body> <!--[if lt IE 8]> <div class="g_tips"> <p> 已經有超過90%的用戶使用更高版本 <a target="_blank" title="下載Chrome" href="http://www.google.com/chrome/">Google Chrome</a> 或 <a target="_blank" href="http://www.microsoft.com/zh-cn/download/ie.aspx?q=internet+explorer">Internet Explorer</a> 體驗到了更流暢更精彩的頁面,你還不試試? </p> </div> <![endif]--> <h1>300,000,00</h1> <script src="js/index.js"></script> <script>// js </script> </body> </html>
<html lang="zh-CN">
性屬說明這個html內容是以中文爲顯示和閱讀基礎,多語言的網站建議添加。
一般狀況下CSS放文檔開始,腳本放在文檔末尾我想不用解釋太多
若是一個頁面足夠簡單,寫在頁面上是徹底 OK 的,特別是一些簡單的專題,可是項目上需謹慎使用
做者:10029068
出處:百度,淘寶,騰訊三大巨頭HTML頁面規範分解