Search box and button combined 100% width - HTML CSS CSS Form

HTML CSS examples for CSS Form:input button layout

Description

Search box and button combined 100% width

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

body {<!--from  ww  w. j  av a2 s . c om-->
   padding: 0;
   margin: 0;
}
#search {
   float: left;
   border: none;
   background: blue;
   width: 100%;
}
#button {
   border: none;
   background: red;
   float: right;
   width: 5em;
   position: absolute;
   top: 0;
   right: 0;
}
#search-cont {
   padding-right: 5em;
   background-color: yellow;
}
input, div {
   font-size: 12px;
}


      </style> 
 </head> 
 <body> 
  <div> 
   <div id="search-cont"> 
    <input id="search"> 
   </div> 
   <input id="button" type="button" value="Search"> 
  </div>  
 </body>
</html>

Related Tutorials