Create Column layout for Form Using Flexbox - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Column

Description

Create Column layout for Form Using Flexbox

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Simple Flexbox Example</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.flex {<!--   w ww  .  jav a 2s  .c o  m-->
   padding:11px;
}

.flex input,
.flex textarea {
   width:100%;
}

@media (max-width: 400px)  {
   .flex input,
      .flex textarea {
      margin-top:11px;
      margin-bottom:11px;
   }

}

@media (min-width: 400px)  {
   .flex-container {
      display:-webkit-box;
      display:-moz-box;
      display:-ms-flexbox;
      display:-webkit-flex;
      display:flex;
   }
   
   .flex {
      display:-webkit-box;
      display:-moz-box;
      display:-ms-flexbox;
      display:-webkit-flex;
      display:flex;
      flex-direction:column;
      padding:11px;
   }
   
   .left {
      width:41%;
   }
   
   .right {
      -webkit-box-flex:2;
      -moz-box-flex:2;
      width:61%;
      -webkit-flex:2;
      -ms-flex:2;
      flex:2;
   }

}
</style> 
 </head> 
 <body> 
  <form class="flex-container"> 
   <div class="flex left"> 
    <input type="text" placeholder="Your Name*"> 
    <br> 
    <input type="text" placeholder="Your E-Mail Address*"> 
    <br> 
    <textarea placeholder="Subject"></textarea> 
   </div> 
   <div class="flex right"> 
    <textarea placeholder="Type your message here..." rows="7"></textarea> 
   </div> 
  </form>  
 </body>
</html>

Related Tutorials