Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't this disappear after hovering?

Tags:

html

css

JsFiddle

HTML

<p>im a duck</p>

CSS

p:hover {
    display:none;
}

Shouldn't it disappear after hovering?

like image 644
Ergo Proxy Avatar asked Nov 29 '22 00:11

Ergo Proxy


2 Answers

It does disappear.

However, after it disappears, it's no longer hovered, so it re-appears.

Each time you move the mouse, the cycle repeats; if you move the mouse over it, you'll see it flickering.

The exact behavior depends on the browser; in particular, Chrome only recalculates hover states on mouse events.

like image 147
SLaks Avatar answered Dec 09 '22 22:12

SLaks


this will make more sense to you.

html:

<div class="cont"><p>foo</p></div>

css:

.cont{width:100%;height:30px;}
.cont p{}
.cont:hover p{display:none}

hope that helped.

like image 34
geevee Avatar answered Dec 09 '22 22:12

geevee