markwin markwin - 4 months ago 13
CSS Question

:hover#id on all web browser & devices - should work?

Normally we write this way:



#id span:hover {}


I tried this and it worked.

:hover#id span {}


Will this work in all web browsers and devices ?

Answer

Till this date I have used this in many browser, It works perfectly for me in every browser,

HTML
<div id="id">
     <span>hello</span>
     <br>
     <a href="">hover me</a> 
  </div>

Css

  #id span:hover{
   color: red;
  }

In this if you Hover on hello only hello will change the color

Now if you write CSS like

:hover#id span{
  color: red;
}

In this, where ever you hover inside #id, whole block will trigger, not only that particular span.

Comments