Let's imagine a very simple case:
div.className{}
vs
.className{}
Which option is faster and why?
.className{} Faster loading due to smaller css file size.
It is also faster when rendering a page because there is no need to look for elements div.
div
Google manual :
Avoid qualifying identifiers and class names with type selectors. If it is not necessary (for example, with auxiliary classes), do not use element names in combination with identifiers or classes.Avoiding unnecessary ancestor selectors is useful for performance reasons .
Avoid qualifying identifiers and class names with type selectors. If it is not necessary (for example, with auxiliary classes), do not use element names in combination with identifiers or classes.
Avoiding unnecessary ancestor selectors is useful for performance reasons .
div.classname .classname , . , , , , .
div.classname
.classname
ne CSS , , , , ( - ! important ).
.class , . , , ? , div.classname , .box, (div), (.class) (div.class).
, div.class div, , , div.
W3 , . CSS, .
, - , , , , CSS.
Follow Up
Source: https://habr.com/ru/post/1609768/More articles:Delete all not found, that is, delete all keys / values on the map that were not found in the set - c ++Does Oracle mean the default execution plan when parsing a prepared statement? - optimizationclient.GetAsync не обновляет мои данные - c#The number of character repetitions in setting the Lua template - luaRelease malloced structures in function - cHow to reload a page in a Cordova project? - javascriptMatplotlib lining between plot and axis - pythonHow to insert elements in several positions in a vector without iteration - rgeneratePublisherEvidence in CLR4 - .nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1609773/is-it-better-practice-to-conditionally-render-in-react-or-conditionally-add-a-class-to-hide-elements&usg=ALkJrhji_9LPqx2Y2d6rGAFDNdKIWPMdRQAll Articles