Advertisement
trentjs

Horizontal Label and Inputs

Nov 23rd, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.18 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <style>
  6.  
  7.     body{
  8.         background-color: #FFFFFF;
  9.         font-family: Arial, Helvetica, sans-serif;
  10.     }
  11.  
  12.     .hrzFormSet{
  13.         align-items: center;
  14.         display:table;
  15.         width: 100%;
  16.         padding-right: 0.5em;
  17.     }
  18.  
  19.     .hrzFormSet label{
  20.         display: table-cell;
  21.         width: 1px;
  22.         /*USE min-width TO CONTROL WIDTH...   */
  23.         /*min-width: 6em;*/
  24.         text-align: right;
  25.         padding-right: 0.5em;
  26.         white-space: nowrap;
  27.     }
  28.  
  29.     .hrzFormSet input{
  30.         display: table-cell;
  31.         background-color: #fff;
  32.         border: 1px solid #ddd;
  33.         min-width:100%;
  34.         vertical-align: middle;
  35.         padding:0.3em 0em 0.3em 0.3em;
  36.     }
  37.  
  38.     .hrzFormSet input[type='checkbox']{
  39.         display:inline-block;
  40.         min-width: auto;
  41.     }
  42.  
  43. </style>
  44.  
  45. </head>
  46. <body>
  47.  
  48. <h2>Horizontal Label and Input</h2>
  49.  
  50. <div class="hrzFormSet">
  51.     <label>Field 01</label>
  52.     <input type="text" placeholder="Input Info" >
  53. </div>
  54.  
  55. <div class="hrzFormSet">
  56.     <label>Check 01</label>
  57.     <input type="checkbox" placeholder="Input Info" >
  58. </div>
  59.  
  60.  
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement