Show section element on :hover - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover to Show

Description

Show section element on :hover

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
a {<!-- w w w.  j a v a  2 s.  c o m-->
   padding:6px;
   position:relative;
   z-index:2;
}

section {
   position:absolute;
   width:100%;
   height:100%;
   top:0;
   left:0;
   z-index:0;
   opacity:0;
   transition:opacity 1201ms;
}

a:first-child:hover~section {
   opacity:2;
}

a:first-child:hover~section #loka {
   animation:sideways2 6s 2.3s infinite;
}

a:first-child:hover~section #blood {
   animation:sideways3 6s 2.3s infinite;
}

a:first-child:hover~section #smoke {
   animation:sideways4 6s 2.3s infinite;
}

html, body {
   width:100%;
   background:black;
}

#main {
   width:100%;
   text-align:center;
   position:relative;
   overflow:hidden;
   height:100vh;
}

#loka, #blood, #smoke, #stalk {
   position:absolute;
   width:100%;
   left:0;
   bottom:0;
}

#ch1, #tango {
   width:201px;
   margin:21px 11px 0px 11px;
}

@keyframes sideways1  {
   0% {
      transform:translateX(0);
   }
   
   50% {
      transform:translateX(-4%);
   }
   
   100% {
      transform:translateX(0);
   }

}

@keyframes sideways2  {
   0% {
      transform:translateX(0);
   }
   
   50% {
      transform:translateX(4%);
   }
   
   100% {
      transform:translateX(0);
   }

}

@keyframes sideways3  {
   0% {
      transform:translateX(-0.6%);
   }
   
   50% {
      transform:translateX(2%) scale(2.6);
   }
   
   100% {
      transform:translateX(-0.6%);
   }

}

@media (min-width: 1600px)  {
   #ch1, #tango {
      width:251px;
   }

}

@media (min-width: 1920px)  {
   #ch1, #tango {
      width:276px;
   }

}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <a href="1/cover.html"> <img src="https://www.java2s.com/style/demo/Firefox.png" alt="111" id="ch1"> </a> 
   <a href="tango/1.html"> <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt="222" id="tango"> </a> 
   <section> 
    <img src="https://www.java2s.com/style/demo/Firefox.png" alt="aaa" id="loka"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt="bbb" id="blood"> 
    <img src="https://www.java2s.com/style/demo/Safari.png" alt="ccc" id="smoke"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt="ddd" id="stalk"> 
   </section> 
  </div>  
 </body>
</html>

Related Tutorials