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

              
                <section class="wrapper">
  
  <!-- BEGIN: menu -->
  <nav class="menu">
    <ul class="menu__list">
      <li class="menu__item  js-modify  active" data-target=".card" data-effect="zoom">Zoom out</li>
      <li class="menu__item  js-modify" data-target=".card" data-effect="blur">Blur</li>
      <li class="menu__item  js-modify" data-target=".card" data-effect="color">Colors</li>
    </ul>
  </nav>
  <!-- END: menu -->
  
  <!-- BEGIN: card -->
  <div class="card" data-effect="zoom">
    <button class="card__save  js-save" type="button">
      <i class="fa  fa-bookmark"></i>
     </button>
    <figure  class="card__image">
      <img src="https://c1.staticflickr.com/4/3935/32253842574_d3d449ab86_c.jpg" alt="Short description">
    </figure>
    <div class="card__header">
      <figure class="card__profile">
        <img src="https://upload.wikimedia.org/wikipedia/commons/1/1c/Neil_Armstrong.jpg" alt="Short description">
      </figure>
    </div>
    <div class="card__body">
      <h3 class="card__name">Neil Armstrong</h3>
      <p class="card__job">astronaut & engineer</p>
      <p class="card__bio"> American astronaut, engineer, and the first person to walk on the Moon.</p>
    </div>
    <div class="card__footer">
      <p class="card__date">Feb 10 2018</p>
      <p class=""></p>
    </div>
  </div>
  <!-- END: card -->
  
</section>
              
            
!

CSS

              
                /* GLOBAL VARIABLES */
:root {
  --font: "Roboto", sans-serif;
  --fontOrigin: 1rem;     /* 16px */
  --fontSmall: 0.625em;   /* 10px */
  --fontMedium: 0.875em;  /* 14px */
  --fontNormal: 1em;      /* 16px */
  --fontLarge:  1.375em;  /* 22px */
  --fontLight: 100;
  --fontRegular: 400;
  --speed: 0.65s;
}

@keyframes zoom {
  from {
    object-position: 0 50%;
  }
  to {
    object-position: 100% 50%;
  }
}

@keyframes blur {
  from {
    -webkit-transform: scale(1, 1);
    transform: scale(1, 1);
  }
  to {
    -webkit-transform: scale(1.5, 1.5);
    transform: scale(2, 2);
  }
}

* {
  border: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-weight: var(--fontOrigin);
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0.005rem;
  -webkit-font-smoothing: subpixel-antialiased;
  font-smoothing: subpixel-antialiased;
}

.wrapper {
  display: grid;
  grid-template-columns: repeat( auto-fit, 1fr );
  grid-template-rows: auto;
  grid-template-areas:
    "menu menu menu"
    ". card .";
  width: 100vw;
  min-height: 100vh;
  padding-top: 40px;
  padding-bottom: 40px;
}

.menu {
  grid-area: menu;
  align-self: end;
}

.menu__list {
  text-align: center;
}

.menu__item {
  position: relative;
  display: inline-block;
  padding: 10px 20px;
  font-size: var(--fontMedium);
  font-weight: var(--fontRegular);
  text-transform: uppercase;
  color: #a9a9a9;
  cursor: pointer;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.menu__item::after {
  content: "";
  display: block;
  width: 0;
  height: 2px;
  margin-top: 6px;
  background: rgba(100, 100, 250, 1);
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.menu__item:hover {
  color: rgba(150, 150, 255, 1);
}
.menu__item.active {
  color: rgba(100, 100, 250, 1);
}

.menu__item.active::after {
  width: 100%;
}

.card {
  position: relative;
  grid-area: card;
  align-self: center;
  justify-self: center;
  overflow: hidden;
  display: block;
  width: 100%;
  max-width: 250px;
  height: 400px;
  font-size: var(--fontOrigin);
  border-radius: 8px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card:hover {
  box-shadow: 0 40px 130px rgba(0, 0, 0, 0.6);
  -webkit-transform: scale(1.1, 1.1);
  transform: scale(1.1, 1.1);
}

.card__save {
  position: absolute;
  top: 10px;
  right: 10px;
  display: block;
  width: 35px;
  height: 35px;
  background: transparent;
  border: 0;
  opacity: 0;
  border-radius: 3px;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card__save:focus {
  outline: 0;
  background-color: rgba(255, 255, 255, 0);
}

.card:hover .card__save {
  opacity: 0.6;
}

.card__save i {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card__save:hover i {
  color: rgba(255, 255, 255, 0.8);
}

.card__save:active,
.card__save.active {
  opacity: 1 !important;
}

.card__save:active i,
.card__save.active i {
  color: white;
}

.card__image {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.5));
}

.card__image img {
  -webkit-transform: scale(1.3, 1.3);
  transform: scale(1.3, 1.3);
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
  animation-name: zoom;
  animation-duration: 30s;
  animation-direction: alternate;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.card:hover .card__image img {
  -webkit-transform: scale(1, 1);
  transform: scale(1, 1);
  opacity: 0.5;
}

.card__header {
  display: grid;
  width: 100%;
  height: 200px;
}

.card__profile {
  align-self: center;
  justify-self: center;
  display: block;
  overflow: hidden;
  width: 10vmax;
  height: 10vmax;
  max-width: 100px;
  max-height: 100px;
  border-radius: 50%;
}

.card__profile img {
  -webkit-transform: scale(1.5, 1.5)  translateZ(0);
  transform: scale(1.5, 1.5)  translateZ(0);
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  -webkit-filter: grayscale(50%) contrast(75%) brightness(1.3);
  filter: grayscale(50%) contrast(75%) brightness(1.3);
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
  mix-blend-mode: normal;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card:hover .card__profile img {
  -webkit-transform: scale(1, 1)  translateZ(0);
  transform: scale(1, 1)  translateZ(0);
}

.card__body {
  display: grid;
  padding: 0 20px;
}

.card__name {
  align-self: center;
  justify-self: center;
  margin-bottom: 2px;
  color: white;
  font-size: var(--fontLarge);
  font-weight: var(--fontLight);
  letter-spacing: 0.1rem;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background: -webkit-linear-gradient(white, #a1a1a1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card:hover .card__name {
  background: -webkit-linear-gradient(white, #c1c1c1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card__job {
  align-self: center;
  justify-self: center;
  display: inline-block;
  font-size: var(--fontSmall);
  font-weight: var(--fontLight);
  text-align: center;
  letter-spacing: 0.35rem;
  color: rgba(100, 130, 200, 0.45);
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card:hover .card__job {
  color: rgba(100, 130, 200, 1);
}

.card__bio {
  position: relative;
  -webkit-transform: translateY(30%);
  transform: translateY(30%);
  display: block;
  margin: 22px 0 16px 0;
  font-size: var(--fontMedium);
  font-weight: var(--fontLight);
  /*text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.35);*/
  color: rgba(255, 255, 255, 0.65);
  opacity: 0;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card:hover .card__bio {
  -webkit-transform: translateY(0);
  transform: translateY(0);
  opacity: 1;
}

.card__footer {
  position: relative;
  -webkit-transform: translateY(60%);
  transform: translateY(60%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-areas: "date category";
  padding: 10px 20px;
  opacity: 0;
  -webkit-transition: all var(--speed) ease;
  transition: all var(--speed) ease;
}

.card:hover .card__footer {
  -webkit-transform: translateY(0);
  transform: translateY(0);
  opacity: 1;
}

.card__date {
  grid-area: date;
  display: inline-block;
  align-self: left;
  justify-self: left;
  font-size: var(--fontSmall);
  font-weight: var(--fontLight);
  text-transform: uppercase;
  text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.45);
  color: rgba(250, 250, 250, 0.4);
}

/* MODIFIERS */
.card[data-effect="blur"]:hover .card__image img {
  -webkit-filter: blur(3px);
  filter: blur(3px);
}

.card[data-effect="blur"] .card__image img {
  animation-name: blur;
}

.card[data-effect="color"]:hover {
  -webkit-transform: scale(1, 1);
  transform: scale(1, 1);
  box-shadow: 0 40px 260px rgba(255, 0, 0, 0.1), 0 40px 130px rgba(250, 100, 100, 0.2), -80px -40px 230px rgba(0, 200, 250, 0.15), 80px 40px 230px rgba(120, 120, 255, 0.15);
}

.card[data-effect="color"] .card__image {
  background: linear-gradient(to bottom, rgba(20, 20, 100, 1), rgba(255, 100, 100, 0.5))
}

.card[data-effect="color"]:hover .card__image img {
  opacity: 0.8;
}

.card[data-effect="color"]:hover .card__profile img {
  -webkit-filter: grayscale(50%) contrast(80%) brightness(1.6);
  filter: grayscale(50%) contrast(80%) brightness(1.6);
  mix-blend-mode: normal;
}
              
            
!

JS

              
                var demoButtons;

function start () {
  
  // Add event "click" to "demo buttons"
  demoButtons = document.querySelectorAll ('.js-modify');
  for (var i = 0; i < demoButtons.length; i++) {
    demoButtons[i].addEventListener ('click', toggleEffect);
  }
  
  // Add event "click" to "save buttons"
  var saveButtons = document.querySelectorAll ('.js-save');
  for (var i = 0; i < saveButtons.length; i++) {
    saveButtons[i].addEventListener ('click', toggleActive);
  }
  
}

// Toggle "effect" classes
function toggleEffect () {
  var target = document.querySelector (this.dataset.target);
      target.dataset.effect = this.dataset.effect;
  
  for (var i= 0; i < demoButtons.length; i++) {
    demoButtons[i].classList.remove ('active');
  }
  
  toggleActive.call (this);
}

// Toggle "active" class
function toggleActive () {
  this.classList.toggle ('active');
}

// Invoke "start ()" function
window.addEventListener ('load', start);
              
            
!
999px

Console