CSS and HTML mouse?

ive was googling, but doesn't seem to be able to find a hover-like method for css for css.

Is there one, and if so, how to encode it?

+4
source share
7 answers

You only need :hover pseudo-class for this , when you exit an element, it will return to it by default not :hover , for example:

 .class { color: black; } .class:hover { color: red; } 

when you hover, the color will be red, and when you "mouseout", the color will return to black because it will no longer match the :hover selector. This is the default behavior for all browsers, nothing special you need to do here.

If you want to do something software, you are looking for a mouseout JavaScript event .

+5
source

There is no mouse event in CSS. For this you need javascript.

+1
source

There is a pseudo-class :hover :

 element:hover { color: red } 

there is no event or selector when the status :hover ends, if that is what you are looking for.

To do this, you need to access Javascript and the onmouseout event.

+1
source

There is no mouseout type selector for CSS. But the normal style of an element is its β€œmouse” state!

What exactly are you trying to do so that normal CSS and the :hover selector do not display?

You can most likely do this using JavaScript. See here or here .

+1
source

You are looking for :hover pseudo-class .

 a:hover {background: red;} 

will highlight any link you place.

0
source

As far as I know, you can only have the following CSS "events".

a (default), a: hang, a: active, a: visited

0
source

AFAIK There is no mouse event, but

if you want to use the link you visit earlier, you can use

 a:visited{ } 
0
source

Source: https://habr.com/ru/post/1314196/


All Articles