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

              
                <h1>object-fit &amp; object-position</h1>

<h2>object-fit:</h2>

<figure>
  <figcaption>object-fit: fill(initial)</figcaption>
  <img class="object-fit-fill" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-fit: contain</figcaption>
  <img class="object-fit-contain" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-fit: cover</figcaption>
  <img class="object-fit-cover" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-fit: none</figcaption>
  <img class="object-fit-none" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-fit: scale-down(smallest one of none or contain)</figcaption>
  <img class="object-fit-scale-down" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>



<h2>object-position:</h2>

<figure>
  <figcaption>object-position: 50% 50%(initial)</figcaption>
  <img class="object-position-initial object-fit-contain" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-position: 80px 160px</figcaption>
  <img class="object-position-length object-fit-contain" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>

<figure>
  <figcaption>object-position: top</figcaption>
  <img class="object-position-keyword object-fit-contain" src="//naradesign.github.io/html5/img/example.jpg" alt>
</figure>
              
            
!

CSS

              
                figure { 
  display: inline-block; 
  margin: 16px;
}
figcaption { 
  font-size: 20px;
  font-weight: 700; 
}
img[class^='object'] {
  background-image: 
    linear-gradient(45deg, silver 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, silver 25%),
    linear-gradient(-45deg, silver 25%, transparent 25%),
    linear-gradient(-45deg, transparent 75%, silver 75%);
  background-size: 20px 20px;
  background-position: 0 0, -10px 10px, 0 -10px, 10px 0;
  width: 240px;
  height: 240px;
}

/* object-fit */
.object-fit-fill { object-fit: fill; } /* 초깃값, 채우기, 비율 무시 */
.object-fit-contain { object-fit: contain; } /* 포함하기, 넘치지 않음, 비율 유지 */
.object-fit-cover { object-fit: cover; } /* 채우기, 넘침, 비율 유지 */
.object-fit-none { object-fit: none; } /* 원본 크기와 비율로 노출하기 */
.object-fit-scale-down { object-fit: scale-down; } /* none | contain 중에서 작은 크기로 표시 */

/* object-position */
.object-position-initial { object-position: 50% 50%; } /* 초깃값, 가운데 */
.object-position-length { object-position: 80px 160px; } /* <length-percentage> */
.object-position-keyword { object-position: top; } /* keyword */
              
            
!

JS

              
                
              
            
!
999px

Console