国产精品成人VA在线观看,亚洲日韩在线中文字幕综合,亚洲AV电影天堂男人的天堂,久久人人爽人人爽人人av东京热

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁(yè)      DIV+CSS      百度,淘寶,騰訊三大巨頭HTML頁(yè)面規(guī)范分解

百度,淘寶,騰訊三大巨頭HTML頁(yè)面規(guī)范分解

標(biāo)簽: 發(fā)布日期:2014-02-21 00:00:00 682
【兼容html5方案】
百度貼吧,百度圖片的實(shí)現(xiàn)
復(fù)制代碼
		<!--[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>
復(fù)制代碼

 

騰訊isux研究院的實(shí)現(xiàn)
		<!--[if lt IE 9]>
 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
 
淘寶- 我的淘寶頁(yè)實(shí)現(xiàn)同上,只不過(guò)是不同版本
		<!-- [if lt IE 9]>
<script src="http://g.tbcdn.cn//tb/mytaobao/12.12.15/common/??html5shiv-min.js"></script>
<![endif]-->
 
不得不提的一個(gè)插件 https://github.com/aFarkas/html5shiv 在github 上達(dá)到了3453 星的高度,獲得了國(guó)內(nèi)外的廣泛認(rèn)可,如果你厭煩了滿頁(yè)面的div 想盡早擁抱html5 元素,就使用它吧。
 
【兼容模式的選擇】
關(guān)于兼容模式
百度首頁(yè)使用的是
		<meta http-equiv=X-UA-Compatible content=IE=EmulateIE7>

 

百度搜索頁(yè)使用的是
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

 

百度圖片,騰訊isux研究院,淘寶收藏頁(yè)使用的是
		<meta http-equiv="X-UA-Compatible" content="IE=edge"/>

 

X-UA-Compatible 這是個(gè)是IE8的專用標(biāo)記,用來(lái)指定IE8瀏覽器去模擬某個(gè)特定版本的IE瀏覽器的渲染方式 

chrome=1寫法可以達(dá)到的效果是如果安裝了GCF,則使用GCF來(lái)渲染頁(yè)面,如果未安裝GCF,則使用最高版本的IE內(nèi)核進(jìn)行渲染。

百度首頁(yè)那么點(diǎn)東西他當(dāng)然不在乎用哪種模式,更多地去照顧老式瀏覽器; 搜索頁(yè)傾向于速度有GCF的時(shí)候更愿意使用chorme渲染。

不得不吐槽,國(guó)內(nèi)各的銀行支付時(shí)的兼容支持,由此第三種得到大家的共同認(rèn)可似乎也無(wú)可厚非。

 
【移動(dòng)至上】
 
騰訊isux研究院的實(shí)現(xiàn)
		<!-- 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" />
 
淘寶主頁(yè)的實(shí)現(xiàn)
		<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" />

 

這里沒(méi)貼百度的,不代表百度不重視這一塊,反而太重視了,19億$買了91無(wú)線 再加上 百度App 貼吧App 音樂(lè)App 圖片APP ... 全有了。
 
【建議升級(jí)】
復(fù)制代碼
		<!--[if lt IE 8]>
<div class="g_tips">
    <p>已經(jīng)有超過(guò)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> 體驗(yàn)到了更精彩的頁(yè)面,你還不試試?</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>
復(fù)制代碼
 
什么,連ie8都不是? 無(wú)法容忍啊,建議你早點(diǎn)換吧! 
 
【參考模版】
復(fù)制代碼
		<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>頁(yè)面名稱</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>
            已經(jīng)有超過(guò)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>
            體驗(yàn)到了更流暢更精彩的頁(yè)面,你還不試試?
        </p>
    </div>
    <![endif]-->
 
    <h1>300,000,00</h1>
 
    <script src="js/index.js"></script>
    <script>// js
  </script>
</body>
</html>
復(fù)制代碼

 

<html lang="zh-CN"> 性屬說(shuō)明這個(gè)html內(nèi)容是以中文為顯示和閱讀基礎(chǔ),多語(yǔ)言的網(wǎng)站建議添加。
  • 通常情況下CSS放文檔開始,腳本放在文檔末尾我想不用解釋太多
  • 如果一個(gè)頁(yè)面足夠簡(jiǎn)單,寫在頁(yè)面上是完全 OK 的,特別是一些簡(jiǎn)單的專題,但是項(xiàng)目上需謹(jǐn)慎使用
 
頁(yè)面全局變量命名隨記 PDC FP PageInfo window.g_config (function(){window.PDC={}})(); 
 
 
【CDN加速】【dataUrl】【css spirte】【按需加載和loader機(jī)制】【壓縮檢查發(fā)布

作為一個(gè)前端開發(fā),這些你做了嗎?