CSS search box how to keep it responsive - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

CSS search box how to keep it responsive

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">
#search-box {<!--  w ww  .  ja v  a  2s. co  m-->
   width:100%;
   height:45px;
   background:Chartreuse;
   border-bottom:2px solid yellow;
   display:block;
}

.search-text {
   width:51%;
}

#search-form {
   positoin:absolute;
   left:17px;
   right:17px;
   width:100%;
   height:31px;
   background-color:blue;
   display:block;
   -webkit-border-radius:11px;
   -moz-border-radius:11px;
   border-radius:11px;
}

#search-text {
   width:100%;
   height:26px;
   background:transparent;
}

#search-box input[type="text"] {
}
#search-button {
   position:absolute;
   top:0;
   left:16px;
   height:43px;
   width:31px;
   text-align:center;
   border-width:0;
   background-color:pink;
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
}
</style> 
 </head> 
 <body> 
  <div class="span12"> 
   <div id="search-box"> 
    <form action="/search" id="search-form" method="get" target="_top"> 
     <input class="search-text" name="q" placeholder="Search by name" type="text"> 
     <button id="search-button" type="submit">Lor</button> 
    </form> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials