Make hidden header appear on smaller screens only - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Header

Description

Make hidden header appear on smaller screens only

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">

header .container {<!--  w ww .j av  a 2 s. c om-->
   position: relative !important;
}
center#showHeader:hover > .headwidth {
   height: 180px;
   width: 100%;
}
.headwidth {
   max-width: 1000px;
   width: 100%;
   position: relative;
   margin: 0 auto;
   background-color: #ffffff;
   display: block;
   transition: .7s;
   height: 0px;
   overflow: hidden;
}
@media screen and (max-width: 480px) {
   .headwidth {
      height: 180px;
   }
}


      </style> 
 </head> 
 <body> 
  <header id="header" role="banner"> 
   <center id="showHeader"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
    <div class="headwidth"> 
     <h1 class="logo"> <a href="index.html" title="Outside The Line"> <img src="https://www.java2s.com/style/demo/InternetExplorer.png" alt=""> </a> </h1> 
     <nav id="main-nav"> 
      <a href="index.html">Work</a> 
      <a href="about.html">About</a> 
      <a href="">Testimonials</a> 
      <a href="contact.html">Contact</a> 
     </nav> 
    </div> 
   </center> 
  </header>  
 </body>
</html>

Related Tutorials