cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <form class="ui form">
<div class="ui cards">
  <div class="card">
    <div class="content">
      <div class="ui teal header">input</div>
      <div class="description">
        <div class="field">
          <input type="text" required>
          <label>Email</label>
        </div>
        <div class="field">
          <input type="password" required>
          <label>Password</label>
        </div>                 
      </div>
    </div>
  </div>
  <div class="card">
    <div class="content">
      <div class="ui teal header">textarea</div>
      <div class="description">
        <div class="field">
          <textarea required></textarea>
          <label>Start typing...</label>
        </div>        
      </div>
    </div>
  </div>
  <div class="card">
    <div class="content">
      <div class="ui teal header">select</div>
      <div class="description">
        <div class="field select">
          <select required="required">
            <option value=""></option>
            <option value="">This is a selected option</option>
          </select>
          <label>Select</label>
        </div>
      </div>
    </div>
  </div>
  <div class="card">
    <div class="content">
      <div class="ui teal header">checkbox</div>
      <div class="description">
        <div class="meta">This solution does not work in IE/Edge desktop</div>
        <div class="field checkbox">
          <input type="checkbox" required>
          <label>checkbox</label>
        </div>
        <div class="field checkbox">
          <input type="checkbox" required checked>
          <label>checkbox</label>
        </div>
      </div>
    </div>
  </div>  
</div>
</form>
            
          
!
            
              body {
  background: powderblue;
  margin: 10%;
  * {
    outline: none;
  }
}

.ui.form {
  .field {
    position: relative;
    width: 100%;

    &:not(.checkbox) {
      margin-top: 1rem;
      margin-bottom: 1.7rem;
    }

    label {
      color: lightgrey;
      position: absolute;
      left: .7rem;
      top: .7rem;
      transition: .2s ease-in;
    }

    &.select {
      display: flex;

      &:after {
        align-self: center;
        color: lightgrey;
        content: "\f107";
        font-family: "Icons";
        margin-left: -1rem;
      }

      select {
        background: transparent;
        border: none;
        border-bottom: 2px solid lightgrey;
        padding: .7rem 2rem .7rem .7rem;
        position: relative;
        border-radius: 0;
        // Chrome and Safari both ignore border-radius on <select>
        // elements unless -webkit-appearance is overridden to an appropriate value.
        // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
        -webkit-appearance: none;
        -moz-appearance: none;
        transition: .2s ease-in;

        &:focus {
          outline: none !important;
          border-bottom: 2px solid dodgerblue !important;
        }

        &:focus ~ label,
        &:valid ~ label {
          color: gray;
          font-size: 80%;
          top: -1rem;
          left: 0;
        }
      }
    }

    input:not([type=checkbox]),
    textarea {
      background: transparent;
      border: none;
      border-bottom: 2px solid lightgrey;
      border-radius: 0;
      padding: .7rem;
      transition: .2s ease-in;


      &[value=" "] {
          background: grey !important;
        }

      &:focus ~ label,
      &:valid ~ label {
        color: grey;
        font-size: 80%;
        top: -1rem;
        left: 0;
      }

      &:focus {
        border-bottom: 2px solid dodgerblue;
        outline: none;
      }
    }

    &.checkbox {
      align-items: flex-start;
      align-content: flex-start;
      display: flex;
      margin: .7rem 0;
      position: relative;

      input[type=checkbox] {
        padding: .7rem;
        border: 2px solid lightgrey;
        transition: .2s ease-in;
        -webkit-appearance: none;
        -moz-appearance: none;

        &:focus {
          outline: none;
        }

        &:before {
          color: grey;
          content: "";
          transition: .2s ease-in;
        }

        &:checked {
          padding: .6rem .35rem;
          margin: -.3rem .1rem 0 .7rem;
          border-left: none;
          border-top: none;
          transform: rotate(45deg);
        }
      }

      label {
        font-size: initial;
        position: static;
        margin-left: 1rem;
        align-self: center;
      }
    }
  }  
}

            
          
!
999px
Loading ..................

Console