Align label vertically - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:label

Description

Align label vertically

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">
.pure-form-aligned .pure-control-group {
   margin-bottom:0.6em;
}

.pure-form-aligned .pure-control-group label {
   display:inline-block;
   margin:0 2em 0 0;
   text-align:right;
   vertical-align:middle;<!--from   w  w w  .j a v a  2 s.c o m-->
   width:16em;
}

label.clase {
   
}
input {
   width:31%;
   border:2px solid Chartreuse;
   border-radius:5px;
   box-shadow:0 2px 4px yellow inset;
   box-sizing:border-box;
   display:inline-block;
   padding:0.6em 0.7em;
   vertical-align:middle;
   line-height:normal;
   font-size:100%;
   margin:0;
}
</style> 
 </head> 
 <body> 
  <form class="pure-form pure-form-aligned"> 
   <div class="pure-control-group"> 
    <label for="txtUsuario" class="clase">User</label> 
    <input type="text" name="txtUsuario"> 
   </div> 
   <div class="pure-control-group"> 
    <label for="txtPass" class="clase">Password</label> 
    <input type="password" name="txtPass"> 
   </div> 
  </form>  
 </body>
</html>

Related Tutorials