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 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

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

              
                <div class="figure-layout">
<!--  Image 1  -->
  <figure>
    <img src="https://images.unsplash.com/27/landscape.JPG?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=09ecf76b0a0fe1f246db255e593b6a25&auto=format&fit=crop&w=1050&q=80" alt="image 1">
    <figcaption>
      <a class="author" href="https://unsplash.com/@tiagogerken">@tiagogerken</a>
      A picturesque hilly landscape covered with green vegetation with sun shining through the clouds
    </figcaption>
  </figure>
<!--  /Image 1  -->
<!--  Image 2  -->
  <figure>
    <img src="https://images.unsplash.com/photo-1413752567787-baa02dde3c65?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=00dab0342c1b6498228d16e4a7d82ad3&auto=format&fit=crop&w=1355&q=80" alt="image 2">
    <figcaption>
      <a class="author"
href="https://unsplash.com/@aleskrivec">@aleskrivec
      </a>
      A picturesque valley with a pond, vivid yellow-green foliage and mountains in the distance
    </figcaption>
  </figure>
<!--  /Image 2  -->
 <!--  Image 3  -->
<figure>
    <img src="https://images.unsplash.com/photo-1502117859338-fd9daa518a9a?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=a46c176968e7155fc0d7b746b28bc338&auto=format&fit=crop&w=634&q=80" alt="image 3">
    <figcaption>
      <a class="author"
href="https://unsplash.com/@kalimullin">@kalimullin
      </a>
       Coastline 
    </figcaption>
  </figure>
<!--  /Image 3  -->
<!--  Image 4  -->
<figure>
    <img src="https://images.unsplash.com/photo-1449156733864-dd5471bb7427?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=0170f09ccf046b71bc5d9af1ee782b38&auto=format&fit=crop&w=1050&q=80" alt="image 4">
    <figcaption>
      <a class="author"
href="https://unsplash.com/@olivier_twwli">@olivier_twwli
      </a>
       Empty highway road under dark stormy sky 
    </figcaption>
  </figure>
<!--  /Image 4  -->
</div>
              
            
!

CSS

              
                body {
  background: #000;
}

.figure-layout {
  background: #333; 
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  padding: 25px;
  font-family: 'Montserrat', sans-serif;
}
.figure-layout figure {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: black;
  max-width: 350px;
  max-height: 350px;
  padding: 0px;
  margin: 2px;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 50%;
  border: solid 1px #222;
}
.figure-layout figure img {
  object-fit: cover;
}
.figure-layout figure figcaption {
  position: absolute;
  left: -15px;
  background: black;
  background: linear-gradient(90deg, rgba(0,0,0,0.2553396358543417) 0%, rgba(0,0,0,0.5) 69%, rgba(0,0,0,0.5) 69%, rgba(0,0,0,0.5) 100%);
  width: calc(100% + 30px);
  padding: 10px 20px;
  color: white;
  text-align: center;
  transform: rotate(-10deg);
  box-sizing: border-box;
  cursor: default;
  transition: ease all 0.25s;
}
.figure-layout figure:nth-child(odd) figcaption {
  transform: rotate(-5deg);
}
.figure-layout figure:hover figcaption {
  background: rgba(0,0,0,0.75);
  transform: rotate(0deg);
}
.figure-layout figure figcaption a.author {
  display: block;
  width: max-content;
  color: #ddd;
  font-size: 10pt;
  text-decoration: none;
  padding: 5px;
  box-sizing: border-box;
}
.figure-layout figure figcaption a.author:hover {
  color: #fff;
}
              
            
!

JS

              
                //declarations
let borderRadius = 0.5;
let circleSize = 350;
let radiusSize = circleSize * borderRadius;
let figureImgs = document.querySelector(".figure-layout").querySelectorAll("img");
//use the largest ratio - for image dimensions
for(let img of figureImgs) {
  //flip
  if(img.naturalWidth > img.naturalHeight) {
    img.style.width = `calc(100% +  ${radiusSize}px)`;
    img.style.height = "auto";
  }
  else {
    img.style.height = `calc(100% + ${radiusSize}px)`;
  }
}
              
            
!
999px

Console