Is it more performant to defer CSS to :hover if possible? -


consider following:

.element {     cursor: pointer; }  .element:hover {     cursor: pointer; } 

to me, these 2 css snippets identical. cursor seen when hovering element. either method of decorating cursor works equally well.

i'm curious how works under hood. there preference here using 1 or other? if so, why?

let's analysis here. difference hover pseudo-element, declaratively indicates change rendering in response user actions.

the cursor property description in css3 spec contains following:

this property specifies type of cursor displayed pointing device when on element's border, padding, , content.

this can interpreted modifying cursor response mouseover event.

on other end :hover pseudo selector description in css3 spec contains following:

a visual user agent apply pseudo-class when cursor (mouse pointer) hovers on box generated element.

this applies whole set of properties element in question response mouseover event, mean repainting of portions of screen if had other properties in there, since setting mouse cursor repaint should not happen, using hover cursor can considered syntactic over-complication specific example, since same.

for concrete example there should not significant performance difference since in both cases mouse on event raised, , event handler in native code applies new cursor. repaint not happen.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -