Web開發中的效能:談Google和Facebook的網站使用到的技術,圖片預先載入CSS Sprites

來源:互聯網
上載者:User
(January 11) http://www.handandaily.com

首先我要說的是部落格園的速度開啟的很慢,深圳南山的

如果你知道這種技術,那就不用進來了,

1.首先你先開啟下面兩個串連:(下面連結不是一般的圖片,無毒無廣告)

http://static.ak.facebook.com/images/sprite/icons.png?db3
http://www.google.com/images/nav_logo3.png

剛才在Google搜尋的首頁,發現在bodyonload裡有這麼一句:

if(document.images){new Image().src='/images/nav_logo3.png'}

那麼來看看這個http://www.google.com/images/nav_logo3.png是個啥?

就是它:

Css Sprites,就是將頁面中所有css裝飾圖合并成一個較大的圖,然後用到特定的css裝飾圖的時候就利用css的background-image:大圖,background-position:小圖在大圖中的x位置,小圖在大圖中的y位置

優點:利用Css Sprites可以提升網站的效能,普通製作方式下的大量圖片,現在合并成一個圖片,大大減少了HTTP的串連數。HTTP串連數對網站的載入效能有重要影響。

按照yahoo的 rules for high performance web sites的原則,應當較少Client與Server端間的HTTP Request次數。

通過CSS Sprites方法將多張圖片組裝成單獨的一張圖片,可以有效減少HTTP請求的次數。

關於更多的CSS Sprites
http://www.handandaily.com/post/cat_8.html

  • Murdoch: China, India will reshape the world
  • Telefonica O2 CR contracts Huawei for 3G expansion
  • Huawei ‘to make $2bn in Africa’
  • Huawei seals 3G network deal in Czech
  • Uganda Telecom signed an agreement Thursday with Huawei Technologies to expand its existing Next Generation Network
  • Huawei’s Ever-Expansion Strategy May Hit a Wall, or Not
  • Huawei industry firsts usher in converged ultra broadband era for operators
  • Huawei to expand Uganda telecom’s next generation network
  • Obama’s remarks on China are rhetoric, some say
  • Chinese Regulators Destroy Tons of Tainted Animal Feed
  • China landslide leaves 20 dead, 42 missing
  • Guangzhou:Hotels and Fights Hard to Survive in the Financial Crisis
  • Guangzhou:New Bus/Metro IC Card Put in Use Today
  • Guangzhou:Bird Repays Master by Eating Mosquitoes
  • Huawei pioneer in launching Professional Service Center in Jordan
  • Guangzhou Officially Acclaimed As a “National Garden City”
  • Guaungzhou to Upgrade Neighborhood Environments of Asian Games Venues
  • 500 Million US Dollars Signed between Guangzhou and Europe
  • Guangzhou:Map Shows Fancy Restaurants in Xiguan
  • SKYWORTH Guangzhou Industrial Base Goes Into Production
  • Guangzhou to Improve Management of Professional Markets
  • Convention & Exhibition Industry in Guangzhou Draws International Attention
  • Guangzhou:Over 130,000 Customers Visited in 4-days’ Yangcheng Book Exhibition
  • Guangzhou:Museum to Represent Island Life of Six Centuries Ago
  • Guangzhou:Country Life Attracts Urban Residents
  • Guangzhou:Guangzhong Allies with Russian Ural Heavy Machinery Factory
  • Guangzhou Holds Investment Cooperation Exchange in Germany
  • Second Session of 104th Canton Fair Sealed Export Deals of USD 8.31 Billion
  • Guangzhou:Cases to Go Public through Internet
  • Cantonese Opera Exhibition Hall Would Be Built in Liwan,Guangzhou
  • Ban on Liquid not Removed at Guangzhou Baiyun International Airport
  • Guangzhou:Shiling Leather Industry Gets Boost
  • Guangzhou Gang of Airborne Thieves Arrested on Touch Down
  • Guangzhou Zengcheng Chosen as one of “National Top 10 Ecological Leisure Bases”
  • Guangzhou Police Employs 47 Police Supervisors against Corruption
  • Chigang Tower Park to Become A Memorial Park in guangzhou
  • One-hour Travel throughout Guangzhou by 2020
  • Guangzhou:Family Friend Accused of Raping 21-month-old
  • Shenzhen University:International Teachers Wanted
  • China’s Canton Fair suffers drop in attendance
  • Hello Everyone. Needed some friends in Guangzhou.
  • Guangzhou Toyota keeps 210,000-unit sales goal
  • Guangzhou furniture show draws 36,34
  • BPA to present at HKPCA show in Shenzhen
  • Zhuhai plans Asia’s largest pilot training facility
  • China: Brazil’s Embraer present at Airshow China 2008, in Zhuhai
  • Bombardier Lands at Airshow China 2008, Zhuhai
  • China:Six dead in worst Tibet snowstorm on record, 1,700 others stranded
  • China-Britain Business Council CBBC Shenzhen
  • UK Trade and Investment In Guangzhou
  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.