htmlcssbuttonhoverrollover

Why is my rollover button popping on hover?


can anyone know why my rollover pops on hover. i try very hard to fix but does it? im using a css .hover function see example below please. any suggestions or examples would be grateful for me, thx stew

    }   
body {
background-color: grey;
background: url(http://wizzfree.com/pix/bg1.jpg) fixed;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
margin: 0px;
    
    font-family: Arial;
    color: darkgrey;
    font-size: 12px;
    line-height: .3;
    letter-spacing: .5px;
}
  .call {
    position: fixed;
    top: 180px;
    left: 50%;
    width: 150px;
    height:123px;
    transform:translateX(-50%); /* center */
    z-index: 3;
}
/*........ crossfade on buttons ........*/

    .hover img{
    transition:.3s;
    position:absolute;
}
    .nohover{
    opacity:0;}
    a:hover .hover{
    opacity:0;
}
    a:hover .nohover{
    opacity:1;
}
    .hover {
    position: relative;
}
    .hover img{
    position: absolute;
}
<div class="call">
<a href="startchat.htm">
<img src="http://wizzfree.com/pix/call2.png" width="150" class="nohover">
<img src="http://wizzfree.com/pix/call3.png" width="150" class="hover"></a>
</div>


Solution

  • You have written your CSS wrongly.Replace your CSS with the below one.

    body {
      background-color: grey;
      background: url(http://wizzfree.com/pix/bg1.jpg) fixed;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      overflow: hidden;
      margin: 0px;
      font-family: Arial;
      color: darkgrey;
      font-size: 12px;
      line-height: .3;
      letter-spacing: .5px;
    }
    .call {
        position: fixed;
        top: 180px;
        left: 50%;
        width: 150px;
        height:123px;
        transform:translateX(-50%); /* center */
        z-index: 3;
    }
    
    .hover,.nohover{
        transition:.3s;
        position:absolute;
    }
    .nohover{
        opacity:0;
    }
    a:hover .hover{
        opacity:0;
    }
    a:hover .nohover{
        opacity:1;
    }body {
      background-color: grey;
      background: url(http://wizzfree.com/pix/bg1.jpg) fixed;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      overflow: hidden;
      margin: 0px;
      font-family: Arial;
      color: darkgrey;
      font-size: 12px;
      line-height: .3;
      letter-spacing: .5px;
    }
    .call {
        position: fixed;
        top: 180px;
        left: 50%;
        width: 150px;
        height:123px;
        transform:translateX(-50%); /* center */
        z-index: 3;
    }
    
    .hover,.nohover{
        transition:.3s;
        position:absolute;
    }
    .nohover{
        opacity:0;
    }
    a:hover .hover{
        opacity:0;
    }
    a:hover .nohover{
        opacity:1;
    }
    <div class="call">
      <a href="startchat.htm">
      <img src="http://wizzfree.com/pix/call2.png" width="150" class="nohover">
      <img src="http://wizzfree.com/pix/call3.png" width="150" class="hover"></a>
    </div>