久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

當您特定時,CSS 會更快嗎?

Is CSS faster when you are specific?(當您特定時,CSS 會更快嗎?)
本文介紹了當您特定時,CSS 會更快嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

div.container.container 快嗎?你知道在 jquery 中,如果你更具體地使用你的選擇器,它會更快,因為它迭代更少.. css 是這種情況嗎?

Is div.container faster than .container ? You know like in jquery if you be more specific with your selectors it is faster since it iterates through less.. Is this the case with css ?

有沒有辦法衡量 css 的性能?性能方面,這樣的事情是否重要,或者它基本上都取決于文本重量?

Is there a way to measure performance in css ? Performance wise, does things like this even matter or does it all depend on text weight basically ?

如果有人知道答案,我會很高興,我實際上發(fā)現了一個沒有確定答案的類似問題.如果指定得更好,CSS會更高效嗎?

I'd be happy if someone knows the answer to it, I've actually found a similar question with no certain answer. Can CSS be more efficient if it is better specified?

推薦答案

在現實世界中,速度差異可以忽略不計.
技術方面的 .container 會更快,因為它需要處理的選擇器更少.

In real world the speed difference would be negligible.
To be technical .container would be faster as it has fewer selectors to process.

選擇器具有固有的效率.CSS 選擇器從高到低的順序是這樣的:

Selectors have an inherent efficiency. The order of more to less efficient CSS selectors goes thus:

  1. ID,例如#header
  2. 類,例如.promo
  3. 類型,例如div
  4. 相鄰的兄弟,例如h2 + p
  5. 孩子,例如李>ul
  6. 后裔,*例??如ul a*
  7. 通用,*
  8. 屬性,例如[type="text"]
  9. 偽類/元素,例如a:hover

關于你的第二個問題:

有沒有辦法衡量 CSS 的性能?

Is there a way to measure performance in CSS ?

Steve Souders 推出了一項在線測試來衡量 CSS 的性能,仍然可以在此處訪問該測試.

Steve Souders put out an online test to measure performance of CSS that can still be accessed here.

現在有更好的方法來衡量性能,但這是一種快速簡便的資源,您可以使用.

There are better ways to measure performance nowadays, but this is a quick and easy resource you can play with.

在性能方面,這樣的事情是否重要,或者它基本上都取決于文本重量?

Performance wise, does things like this even matter or does it all depend on text weight basically ?

簡短的回答是不是真的".

The short answer is "not really".

答案很長,視情況而定".如果你在一個簡單的網站上工作,除了一般知識之外,你真的沒有必要對 CSS 性能大驚小怪,你可以從最佳實踐中獲得.

The long answer is, "it depends". If you are working on a simple site there is really no point to make a fuss about CSS performance other than general knowledge you may gain from best practices.

如果您要創(chuàng)建一個包含數萬個 DOM 元素的網站,那么是的,這很重要.

If you are creating a site with tens of thousands of DOM elements then yes, it will matter.

這篇關于當您特定時,CSS 會更快嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

:hover:before text-decoration none has no effects?(:hover:before text-decoration none 沒有效果?)
CSS sibling selectors (select all siblings)(CSS 兄弟選擇器(選擇所有兄弟))
IE: nth-child() using odd/even isn#39;t working(IE:使用奇數/偶數的 nth-child() 不起作用)
How can I tell if an element is in a shadow DOM?(如何判斷一個元素是否在影子 DOM 中?)
Can I use CSS to add a bullet point to any element?(我可以使用 CSS 為任何元素添加項目符號嗎?)
CSS attribute selector for non-empty attributes(非空屬性的 CSS 屬性選擇器)
主站蜘蛛池模板: 国产美女永久免费无遮挡 | 亚洲综合影院 | 国产中文 | 日本成人黄色 | 日本加勒比在线观看 | 日韩毛片网站 | 国产精品理论片 | 韩日欧美 | 国产精品麻豆免费版 | 国产三级一区 | 久久精品国产视频 | 黄色免费大片 | 国产又粗又猛视频免费 | 国产高清在线观看 | 一区在线观看视频 | 亚洲黄色片 | 日韩亚洲欧美在线观看 | 国产成人精品免费视频 | 91精品国产99久久久久久红楼 | 精品一区二区三区免费 | 免费毛片视频 | 羞羞的视频网站 | 成人在线国产 | 欧洲精品一区 | 久久福利视频导航 | 精品欧美黑人一区二区三区 | 日本a在线观看 | 欧美日韩一区二区在线 | 久久九九视频 | 日本大尺度吃奶做爰久久久绯色 | a级黄毛片| 黑人巨大精品欧美一区二区 | 91性高潮久久久久久久久 | 日韩在线| 亚洲黄色在线 | 夜夜狠狠擅视频 | 国产精品高潮呻吟久久 | 性大毛片视频 | 久久精品福利视频 | 午夜精品福利视频 | 国产小视频在线观看 |