Aligning elements within a div for image and input element - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

Aligning elements within a div for image and input element

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">
#sContainer {<!--from   www.  j a  v  a  2s  .  c o m-->
   background-color:Chartreuse;
   text-align:center;
   width:561px;
   height:31px;
}

#inside-container {
   width:396px;
   margin:0 auto;
}

#sBox {
   float:left;
   width:361px;
   height:31px;
}

#sButton {
   background-color:yellow;
   width:31px;
   height:31px;
   float:right;
}
</style> 
 </head> 
 <body> 
  <div id="sContainer"> 
   <div id="inside-container"> 
    <input id="sBox" type="text"> 
    <img id="sButton" alt="Search" src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials