Adding label to an input - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

Adding label to an input

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">
.editor-container {<!--  ww  w  .  ja v a  2  s  .  c o m-->
   display:table;
   width:100%;
}

.editor-row {
   width:100%;
   display:table-row;
}

.editor-label {
   padding-left:.5em;
   width:41%;
}

.editor-label, .editor-field {
   padding-right:.5em;
   padding-bottom:.3em;
   padding-top:.3em;
   display:table-cell;
}

.curFocus {
   background-color:Chartreuse;
   margin:4px;
   padding:4px;
}

.curFocus>div {
   border:3px solid yellow;
   border-width:3px 0px;
}

.curFocus>div:first-child {
   border-width:3px 0px 3px 3px;
}

.curFocus>div:last-child {
   border-width:3px 3px 3px 0px;
}
</style> 
 </head> 
 <body> 
  <div class="editor-container"> 
   <div class="editor-row curFocus"> 
    <div class="editor-label"> 
     <label for="FirstName">First Name</label> 
    </div> 
    <div class="editor-field"> 
     <input class="text-box single-line valid" id="FirstName" name="FirstName" type="text" value="Nancy" maxlength="20"> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials