Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main class="page">
  <form action="" method="post" class="form">
    <fieldset class="formField">
      <legend class="formField__legend">Modifier mon profil</legend>
      <section class="formGrid">
        <div class="formElement">
          <label for="LAST_NAME" class="formElement__label">Nom</label>
          <input id="LAST_NAME" class="formElement__input" type="text" name="lastName" minlength="2" required>
        </div>
        <div class="formElement">
          <label for="FIRST_NAME" class="formElement__label">Prénom</label>
          <input id="FIRST_NAME" class="formElement__input" type="text" name="firstName" minlength="2" required>
        </div>
        <div class="formElement formElement--tall">
          <label for="BIO" class="formElement__label">Bio</label>
          <textarea id="BIO" class="formElement__input" name="bio"></textarea>
        </div>
        <div class="formElement">
          <label for="EMAIL_ADDRESS" class="formElement__label">Email</label>
          <input id="EMAIL_ADDRESS" class="formElement__input" type="email" name="emailAddress" placeholder="monemail@demo.fr" required>
        </div>
        <div class="formElement">
          <label for="PHONE_NUMBER" class="formElement__label">Téléphone (mobile)</label>
          <input id="PHONE_NUMBER" class="formElement__input" type="tel" name="phoneNumber" pattern="^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$">
        </div>
        <div class="formElement">
          <label for="ADDRESS" class="formElement__label">Adresse</label>
          <input id="ADDRESS" class="formElement__input" type="text" name="address">
        </div>
        <div class="formElement">
          <label for="CITY" class="formElement__label">Ville</label>
          <input id="CITY" class="formElement__input" type="text" name="city">
        </div>
        <div class="formElement">
          <label for="ZIP_CODE" class="formElement__label">Code Postal</label>
          <input id="ZIP_CODE" class="formElement__input" type="text" name="zipCode" inputmode="numeric" pattern="[0-9]{5}">
        </div>
      </section>
    </fieldset>
    <fieldset class="formField">
      <legend class="hideAccess">Abonnement aux newsletters</legend>
      <section class="formRow">
        <div class="formElement">
        <input id="NEWSLETTER" class="formElement__input formElement__input--checkbox" type="checkbox" name="newsletter">
        <label for="NEWSLETTER" class="formElement__label">Je souhaite recevoir la newsletter</label>
      </div>
      <div class="formElement">
        <input id="PARTNER_NEWSLETTER" class="formElement__input formElement__input--checkbox" type="checkbox" name="partnerNewsletter">
        <label for="PARTNER_NEWSLETTER" class="formElement__label">Je souhaite recevoir la newsletter des partenaires</label>
      </div>
      </section>
    </fieldset>
    <button class="formSubmit" type="submit">Enregistrer mes modifications</button>
  </form>
</main>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

$_space: 1rem;
@function space($multiplier: 1) { @return $_space * $multiplier; }
$borderColor: #D2D6DB;
$borderLightColor: #FFFFFF;
$backgroundColor: #E5E5E5;
$backgroundLightColor: #FFFFFF;
$textColor: #374151;
$textLightColor: #FFFFFF;
$primary: #5850eb;

* { box-sizing: border-box; }

html {
  font-family: 'Roboto', sans-serif;
  font-style: normal;
  font-size: 10px;
}

.hideAccess {
  overflow: hidden;
  position: absolute;
  clip-path: inset(100%);
  clip: rect(.1rem, .1rem, .1rem, .1rem);
  height: .1rem;
  white-space: nowrap;
  width: .1rem;
}

.page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: space(1.5);
  background-color: $backgroundColor;
}

.form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 102.8rem;
  color: $textColor;
  font-size: 1.6rem;
  padding: space(3.3) space(4.5) space(5.5);
  border-radius: .4rem;
  box-shadow: 0 .4rem .4rem rgba(black, .1);
  background-color: $backgroundLightColor;
}

.formField {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0 0 space(2.5);
  padding: 0;
  border: 0;
  
  &__legend {
    width: 100%;
    padding: 0 0 $_space;
    font-size: 2.4rem;
    font-weight: bold;
    border-bottom: .1rem solid $borderColor;
  }
}

.formGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
  grid-gap: space(2.5);
  width: 100%;
  margin: space(2) 0;
}

.formElement {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  
  &--tall {
    grid-row: auto / span 2;
    
    .formElement__input {
      height: 15.5rem;
      resize: none;
    }
  }
  
  &__label {
    display: flex;
    min-height: 2rem;
    margin: 0 0 space();
  }
  
  &__input {
    height: 5rem;
    width: 100%;
    font-size: inherit;
    margin: 0;
    padding: space(1.5);
    border-radius: .6rem;
    border: .1rem solid $borderColor;
    outline-color: $primary;
    
    &::placeholder {
      opacity: .4;
    }
    
    &--checkbox {
      @extend .hideAccess;
      
      & + .formElement__label {
        position: relative;
        
        &::before {
          content: '';
          transition: background-color ease-in .2s;
          display: flex;
          min-height: 1.6rem;
          max-height: 1.6rem;
          min-width: 1.6rem;
          max-width: 1.6rem;
          margin: 0 $_space 0 0;
          border: .1rem solid $borderColor;
          border-radius: .6rem;
        }
        
        &::after {
          content: '';
          transition: transform ease-in .2s;
          position: absolute;
          left: .5rem;
          top: .15rem;
          transform: scale(0) rotate(45deg);
          display: flex;
          width: .6rem;
          height: 1rem;
          border: solid $borderLightColor;
          border-width: 0 .2rem .2rem 0;
        }
      }
     
      &:focus + .formElement__label::before {
        outline: .2rem ridge $primary;
      }
      
      &:checked + .formElement__label {
        &::before {
          background: $primary;
        }
        
        &::after {
          transform: scale(.8) rotate(45deg);
        }
      }
    }
  }
}

.formRow {
  display: flex;
  flex-wrap: wrap;
  
  .formElement {
    margin: 0 space(2.5) 0 0;
  }
}

.formSubmit {
  transition: background-color ease-in .2s;
  cursor: pointer;
  margin: 0 0 0 auto;
  padding: space(1.5) space(3.5);
  font-size: inherit;
  color: $textLightColor;
  border-radius: .6rem;
  border: .1rem solid $borderColor;
  outline-color: $primary;
  background-color: $primary;
  
  &:hover {
    background-color: darken($primary, 5);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console