Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <div class="iphoneWrapper">
  <div class="iphoneInterface"></div>
  <div class="browserViewport">

    <div class="screenPayment">

      <div class="header">
        <div class="header-logo">DAILY UI</div>
        <div class="header-nav"></div>
      </div>

      <div class="pager">
        <div class="pager-nav type-S"><span class="pager-link"></span>3 / 4<span class="pager-link pager-link-isNext"></span></div>
        <h1 class="pager-headline type-XL">Payment</h1>
      </div>

      <div class="payment">
        <h2 class="payment-headline type-L">Payment method</h2>
        <div class="payment-tab">
          <div class="payment-radioGroup">
            <input id="paypal" name="cardType" type="radio" value="paypal">
            <label for="paypal">PayPal</label>
          </div>
          <p>You will be redirected to PayPal to complete your purchase securely.</p>
        </div>
        <div class="payment-tab payment-tab-isActive">
          <div class="payment-radioGroup">
            <input checked type="radio" name="cardType" id="creditCart" value="creditCard">
            <label for="creditCart">Add credit card</label>
          </div>
          <img class="payment-cardimg"
               src="//my-assets.netlify.com/codepen/dailyui-002/img_cards.svg">
          <div class="textInputGroup">
            <label for="nameOnCard">Name on card</label>
            <input id="nameOnCard"
                   name="nameOnCard"
                   required
                   type="text">
          </div>
          <div class="textInputGroup">
            <label for="cardNumber">Card number</label>
            <input id="cardNumber" name="cardNumber" placeholder="1234 - 5678 - 9876 - 5432" required type="text">
          </div>
          <div class="textInputGroup textInputGroup-halfWidth">
            <label for="expirationDate">Expiration Date</label>
            <input id="expirationDate" name="expirationDate" placeholder="MM / YY" required type="text">
          </div>
          <div class="textInputGroup textInputGroup-halfWidthRight">
            <label for="cvc">CVC</label>
            <input id="cvc" name="cvc" placeholder="XXX" required type="text">
          </div>
        </div>
      </div>

      <div class="billing">
        <h2 class="type-L">Billing address</h2>
        <div class="checkboxGroup">
          <input checked id="billingSameAsShipping" name="billingSameAsShipping" type="checkbox" value="billingSameAsShipping">
          <label for="billingSameAsShipping">My billing address is my shipping address.</label>
        </div>
      </div>

      <input class="buttonCheckout buttonCheckout-web" type="submit" value="Go to checkout">

    </div>

    <div class="screenEndofprototype">
      <div class="endMessage"></div>
    </div>

  </div>

</div>
<input class="buttonCheckout buttonCheckout-mobile" type="submit" value="Go to checkout">
              
            
!

CSS

              
                $desktop: "min-width: 640px";
$mobile: "max-width: 639px";
$textcolor: #263238;
$brandcolor: #00c853;
$light-grey: #eceff1;
$grey: #cfd8dc;

$typeScale: 1.33;
$sizeBase: 18px;
$sizeS: $sizeBase / $typeScale;
$sizeL: $sizeBase * $typeScale;
$sizeXL: $sizeBase * $typeScale * $typeScale;

html,
body {
  color: $textcolor;
  height: 100%;
  font: 400 #{$sizeBase}/140% 'Jaldi', sans-serif;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  width: 100%;
}

body {
  @media ($desktop) {
    background: linear-gradient(-45deg, #0277bd 0%,#0091ea 100%);
    overflow: hidden;
  }
}

.billing {
  margin-top: 36px;
  padding: 0 10px;
}

.billing-headline {
  margin-bottom: 10px;
}

.browserViewport {
  @media ($desktop) {
    height: 602px;
    -ms-overflow-style: none;
    overflow: scroll;
    width: 375px;
  }
}

.buttonCheckout {
  background: $brandcolor;
  border: none;
  bottom: 0;
  color: #fff;
  font: 700 #{$sizeBase} 'Jaldi', sans-serif;
  height: 60px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  outline: 0;
  width: 100%;
}

.buttonCheckout-web {
  position: absolute;
  @media ($mobile) {
    display: none;
  }
}

.buttonCheckout-mobile {
  position: fixed;
  @media ($desktop) {
    display: none;
  }
}

.buttonCheckout:active {
  background: darken($brandcolor, 3%);
}

h1,
h2 {
  padding: 0;
  margin: 0;
}

.checkboxGroup input[type="checkbox"] {
  position: absolute;
  visibility: hidden;
}

.checkboxGroup > label {
  cursor: pointer;
}

.checkboxGroup > input[type="checkbox"]:checked ~ label::before {
  background:
    $brandcolor
    url(//my-assets.netlify.com/codepen/dailyui-002/ico_checkmark.svg)
    center center / 16px 13px
    no-repeat;
  box-sizing: border-box;
  content: "";
  display: inline-block;
  height: 25px;
  margin-right: 10px;
  top: 7px;
  transition: 150ms ease-out;
  position: relative;
  width: 25px;
}

.checkboxGroup > input[type="checkbox"]:not(:checked) ~ label::before {
  background: #fff center center / 16px 13px no-repeat;
  border: 2px solid $grey;
  box-sizing: border-box;
  content: "";
  display: inline-block;
  height: 25px;
  margin-right: 10px;
  top: 7px;
  transition: 150ms ease-out;
  position: relative;
  width: 25px;
}

.header {
  border-bottom: 1px solid $light-grey;
  height: 40px;
  display: block;
  position: relative;
  width: 100%;
}

.header-logo {
  color: $textcolor;
  font: 700 0.88rem 'Jaldi', sans-serif;
  left: 13px;
  top: 8px;
  position: absolute;
}

.header-logo::before {
  background: $textcolor;
  content: "";
  display: inline-block;
  height: 13px;
  margin: auto 10px auto auto;
  position: relative;
  top: 1px;
  transform: rotate(45deg);
  width: 13px;
}

.header-nav {
  background: url(//my-assets.netlify.com/codepen/dailyui-002/ico_menu.svg) no-repeat;
  height: 18px;
  position: absolute;
  top: 11px;
  right: 10px;
  width: 26px;
}

.iphoneInterface {
  @media ($desktop) {
    background:
      url(//my-assets.netlify.com/codepen/dailyui-002/img_statusbar.png)
      center center / 100% 100%
      no-repeat;
    height: 65px;
    width: 375px;
  }
}

.iphoneWrapper {
  @media ($desktop) {
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0px 30px 100px rgba(0,0,0,0.35);
    height: 667px;
    left: 50%;
    overflow: hidden;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 375px;
    // flex-shrink: 0;
  }
}

.screenPayment {
  padding-bottom: 100px;
}

.type-S {
  color: $textcolor;
  font: 700 #{$sizeS}/100% 'Jaldi', sans-serif;
}

.type-L {
  color: $textcolor;
  font: 700 #{$sizeL}/100% 'Jaldi', sans-serif;
}

.type-XL {
  color: $textcolor;
  font: 700 #{$sizeXL}/100% 'Jaldi', sans-serif;
}

ul {
  padding: 0;
  margin: 0;
}

.pager {
  text-align: center;
  position: relative;
  width: 100%;
}

.pager-headline {
  margin-top: 0.6rem;
}

.pager-nav {
  margin-top: 16px;
}

.pager-link {
  background: url(//my-assets.netlify.com/codepen/dailyui-002/ico_arrow.svg);
  display: inline-block;
  height: 14px;
  margin-right: 5px;
  top: 3px;
  position: relative;
  width: 15px;
}

.pager-link-isNext {
  background: url(//my-assets.netlify.com/codepen/dailyui-002/ico_arrowRight.svg);
  margin-left: 5px;
  margin-right: 0px;
  opacity: 0.25;
}

.payment {
  margin-top: 36px;
  padding: 0 10px;
}

.payment-cardimg {
  height: 23px;
  position: absolute;
  right: 19px;
  top: 16px;
  width: 96px;
}

.payment-headline {
  margin-bottom: 10px;
}

.payment-radioGroup {
  margin-bottom: 10px;
}

.payment-radioGroup > input {
  position: absolute;
  visibility: hidden;
}

.payment-radioGroup > input:checked ~ label::before {
  border: 7px solid $brandcolor;
}

.payment-radioGroup > input:checked ~ label {
  font: 700 1rem 'Jaldi', sans-serif;
}

.payment-radioGroup > label {
  cursor: pointer;
  display: block;
  position: relative;
  top: -2px;
}

.payment-radioGroup > label::before {
  transition: 100ms ease-out;
  box-sizing: border-box;
  background: #fff;
  border: 2px solid $grey;
  border-radius: 100%;
  content: "";
  display: inline-block;
  height: 22px;
  margin-right: 10px;
  position: relative;
  top: 6px;
  width: 22px;
}

.payment-tab {
  background: $light-grey;
  border: 2px solid $light-grey;
  box-sizing: border-box;
  height: 60px;
  overflow: hidden;
  padding: 13px 20px;
  position: relative;
  transition: 150ms ease-out;
  width: 100%;
}

.payment-tab:first-of-type {
  border-radius: 5px 5px 0 0;
}

.payment-tab:last-of-type {
  border-radius: 0 0 5px 5px;
}

.payment-tab-isActive {
  background: #ffffff;
}

.payment-tab-isActive:nth-of-type(1) {
  height: 140px;
}

.payment-tab-isActive:nth-of-type(2) {
  height: 307px;
}

.textInputGroup > input {
  border: 2px solid $grey;
  border-radius: 5px;
  box-sizing: border-box;
  display: block;
  font: 400 $sizeBase 'Jaldi', sans-serif;
  height: 50px;
  margin: -15px auto 5px;
  padding: 5px 10px 0 11px;
  transition: 100ms ease-out;
  width: 100%;
}

.textInputGroup > input:focus {
  border: 2px solid $brandcolor;
  outline: 0;
}

.textInputGroup > label {
  background: #ffffff;
  display: inline-block;
  font: 700 $sizeBase 'Jaldi', sans-serif;
  margin: 5px auto auto 8px;
  padding: 0px 5px;
}

.textInputGroup-halfWidth {
  float: left;
  width: 48%;
}

.textInputGroup-halfWidthRight {
  float: right;
  width: 48%;
}

              
            
!

JS

              
                // Resize the prototype to fit in the window, switch to regular fullscreen mode on mobile screens
var container = document.querySelector('.iphoneWrapper'),
    screenMargin = .2,
    desktopmode = 640;

function resizeScreen() {
  var screenHeight = container.offsetHeight,
      screenWidth = container.offsetWidth,
      windowHeight = document.documentElement.clientHeight / (1 + screenMargin),
      windowWidth = document.documentElement.clientWidth / (1 + screenMargin),
      windowFullWidth = document.body.offsetWidth,
      scale;

  if (windowFullWidth < desktopmode) {
    container.style.transform = '';
    return;
  }

  scale = Math.min(windowWidth/screenWidth, windowHeight/screenHeight);

  if (scale < 1) {
    container.style.transform = 'translate(-50%, -50%) scale(' + scale + ')';
  } else {
    container.style.transform = 'translate(-50%, -50%) scale(1)';
  };
};

window.onresize = resizeScreen;
resizeScreen();

// Payment: Expand the accordion
var radios = document.querySelectorAll('.payment-radioGroup > input');

for (var i = 0; i < radios.length; i++) {
  radios[i].addEventListener('change', expandAccordion);
}

function expandAccordion (event) {
  var allTabs = document.querySelectorAll('.payment-tab');
  for (var i = 0; i < allTabs.length; i++) {
    allTabs[i].classList.remove('payment-tab-isActive');
  }
  event.target.parentNode.parentNode.classList.add('payment-tab-isActive');
}
              
            
!
999px

Console