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="grid">
  <button type="button" class="left">
    <svg width="90" height="91" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path fill-rule="evenodd" clip-rule="evenodd" d="M89.957 45.478C89.957 20.679 69.779.5 44.979.5 20.177.5 0 20.679 0 45.478c0 24.8 20.177 44.979 44.979 44.979 24.8 0 44.978-20.179 44.978-44.979zm-4.613 0c0 22.258-18.108 40.366-40.365 40.366-22.261 0-40.366-18.108-40.366-40.366S22.718 5.113 44.979 5.113c22.257 0 40.365 18.107 40.365 40.365zM53.867 29.33a2.303 2.303 0 00-3.263 0L36.086 43.844a2.314 2.314 0 000 3.263l14.517 14.52a2.314 2.314 0 003.264 0c.898-.903.9-2.362 0-3.263L40.983 45.476l12.884-12.884c.9-.902.9-2.361 0-3.262z" fill="#fff" />
    </svg>
  </button>
  <div class="big">
    <img src="https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1567&q=80" alt="3d">
  </div>
  <div class="small">
    <img class="active" src="https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1567&q=80" alt="3d">
  </div>
  <div class="small">
    <img src="https://images.unsplash.com/photo-1618172193763-c511deb635ca?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1559&q=80" alt="3d">
  </div>
  <div class="small">
    <img src="https://images.unsplash.com/photo-1617791160588-241658c0f566?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1559&q=80" alt="3d">
  </div>
  <div class="small">
    <img src="https://images.unsplash.com/photo-1618472609777-b038f1f04b8d?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1559&q=80" alt="3d">
  </div>
  <div class="small">
    <img src="https://images.unsplash.com/photo-1618172193622-ae2d025f4032?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1559&q=80" alt="3d">
  </div>
  <button type="button" class="right">
    <svg width="91" height="91" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path fill-rule="evenodd" clip-rule="evenodd" d="M.5 45.478C.5 20.679 20.678.5 45.478.5 70.28.5 90.457 20.679 90.457 45.478c0 24.8-20.177 44.979-44.979 44.979C20.678 90.457.5 70.278.5 45.478zm4.613 0c0 22.258 18.108 40.366 40.365 40.366 22.261 0 40.366-18.108 40.366-40.366S67.739 5.113 45.478 5.113c-22.257 0-40.365 18.107-40.365 40.365zM36.59 29.33a2.303 2.303 0 013.263 0l14.518 14.514a2.315 2.315 0 010 3.263l-14.517 14.52a2.314 2.314 0 01-3.264 0 2.31 2.31 0 010-3.263l12.884-12.888L36.59 32.592c-.9-.902-.9-2.36 0-3.262z" fill="#fff" />
    </svg>
  </button>
</div>
              
            
!

CSS

              
                body {
  background-color: #000000;
  padding-left: 10%;
  padding-right: 10%;
  width: 80%;
  padding-top: 20px;
  padding-bottom: 50px;
  position: relative;
  margin: 0 auto;
}
* {
  box-sizing: border-box;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: 1fr 150px;
  grid-gap: 30px;
  flex-wrap: wrap;
  padding-bottom: 60px;
}
.big {
  grid-column: span 5;
  grid-row: span 1;
}
.active {
  border: 3px solid #ffffff;
  border-radius: 20px;
}
.small {
  cursor: pointer;
}
.small:hover img {
  border: 3px solid #ffffff;
  border-radius: 20px;
}
button {
  background: transparent;
  padding: 0;
  border: 0;
}
svg {
  display: block;
}
img {
  border-radius: 20px;
  object-fit: cover;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.left {
  position: absolute;
  top: 40%;
  left: 0;
}

.right {
  position: absolute;
  top: 40%;
  right: 0;
}

@media (max-width: 1500px) {
  .grid {
    grid-template-rows: 1fr 70px;
    gap: 20px 10px;
  }
  .right,
  .left {
    transform: scale(0.5);
    padding: -10px;
    top: 35%;
  }
}
@media (max-width: 910px) {
  .grid {
    grid-template-rows: 1fr 70px;
    gap: 20px 10px;
  }
  .right,
  .left {
    transform: scale(0.4);
    margin: -30px;
    top: 35%;
  }
  img {
    border-radius: 10px;
    object-fit: cover;
    width: 100%;
  }
}

@media (max-width: 660px) {
  .grid {
    grid-template-rows: 1fr 70px;
    gap: 10px 10px;
  }

  .right,
  .left {
    display: none;
  }
  img {
    border-radius: 5px;
    object-fit: cover;
    width: 100%;
  }
}

              
            
!

JS

              
                let img = document.querySelectorAll('.small img');
console.log(img);
if (img.length != 0) {
img.forEach(function(item){
item.addEventListener('click', function(event) {
 let img = document.querySelector('.big img');
 let currentSrc = item.src;
 img.src = currentSrc;
 let active = document.querySelector('.active');
 active.classList.remove('active');
 item.classList.add('active');
})
})
}
              
            
!
999px

Console