Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="responsive">Resize to view responsiveness. Current view:
</div>
<!-- Skater -->
<picture>
  <!-- Largest Desktop -->
  <source
    media="(min-width: 1280px)"
    sizes="1200px"
    ix-path="unsplash/skater.jpg"
    ix-params='{
      "w": 2048,
      "h": 900,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".4",
      "fp-y": ".35",
      "fp-z": "1"       
    }'
  >
  <!-- Small Desktop -->
  <source
    media="(min-width: 960px)"
    sizes="940px"
    ix-path="unsplash/skater.jpg"
    ix-params='{
      "w": 940,
      "h": 360,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".4",
      "fp-y": ".35",
      "fp-z": "1.5"
    }'
  >
  <!-- Tablet -->
  <source
    media="(min-width: 480px)"
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/skater.jpg"
    ix-params='{
      "w": 640,
      "h": 420,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".4",
      "fp-y": ".35",
      "fp-z": "1.75"
    }'
  >
  <!-- Phone -->
  <source
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/skater.jpg"
    ix-params='{
      "w": 300,
      "h": 300,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".4",
      "fp-y": ".35",
      "fp-z": "2.5"
    }'
  >
  <img ix-path="unsplash/astronaut.jpg">
</picture>
<br>
<!-- Games -->
<picture>
  <!-- Largest Desktop -->
  <source
    media="(min-width: 1280px)"
    sizes="1200px"
    ix-path="unsplash/games.jpg"
    ix-params='{
      "w": 2048,
      "h": 900,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".28",
      "fp-y": ".375",
      "fp-z": "1"   
    }'
  >
  <!-- Small Desktop -->
  <source
    media="(min-width: 960px)"
    sizes="940px"
    ix-path="unsplash/games.jpg"
    ix-params='{
      "w": 940,
      "h": 360,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".28",
      "fp-y": ".375",
      "fp-z": "1.5"
    }'
  >
  <!-- Tablet -->
  <source
    media="(min-width: 480px)"
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/games.jpg"
    ix-params='{
      "w": 640,
      "h": 420,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".28",
      "fp-y": ".375",
      "fp-z": "1.75"
    }'
  >
  <!-- Phone -->
  <source
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/games.jpg"
    ix-params='{
      "w": 300,
      "h": 300,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".28",
      "fp-y": ".375",
      "fp-z": "3"
    }'
  >
  <img ix-path="unsplash/games.jpg">
</picture>
<br>
<!-- Crowd -->
<picture>
  <!-- Largest Desktop -->
  <source
    media="(min-width: 1280px)"
    sizes="1200px"
    ix-path="unsplash/crowd.jpg"
    ix-params='{
      "w": 2048,
      "h": 900,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".12",
      "fp-y": ".435",
      "fp-z": "1"
    }'
  >
  <!-- Small Desktop -->
  <source
    media="(min-width: 960px)"
    sizes="940px"
    ix-path="unsplash/crowd.jpg"
    ix-params='{
      "w": 940,
      "h": 360,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".12",
      "fp-y": ".435",
      "fp-z": "1.5"
    }'
  >
  <!-- Tablet -->
  <source
    media="(min-width: 480px)"
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/crowd.jpg"
    ix-params='{
      "w": 640,
      "h": 420,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".12",
      "fp-y": ".435",
      "fp-z": "1.75"
    }'
  >
  <!-- Phone -->
  <source
    sizes="calc(100vw - 40px)"
    ix-path="unsplash/crowd.jpg"
    ix-params='{
      "w": 300,
      "h": 300,
      "fit": "crop",
      "crop": "focalpoint",
      "fp-x": ".12",
      "fp-y": ".435",
      "fp-z": "2"
    }'
  >
  <img ix-path="unsplash/crowd.jpg">
</picture>
<section class="content">
    <article>
    <h1>Set a custom Focal Point to Crop Photos</h1>
    <h2>Art direction & responsive images with imgix</h2>
    <p>Cropping for editorial generally requires multiple sizes and aspect ratios for each image, to support both multiple uses (hero unit,  thumbnails) and responsive design requirements (square for mobile view, widescreen for desktop). Because all of these are coming from the same original, manually cropping and saving separate files is wasted effort.</p>

<p>Instead, with imgix you can generate every version on-demand to bring the most compelling and relevant parts of the image forward, and then plug those URLs into your responsive breakpoints. Let’s see how this works with some typical editorial-type photos. We’ll go step-by step for each of the crops here—check out the related CodePen to see the underlying responsive HTML and how we’re using imgix.js to generate a complete `srcset` to support any size we might choose in the future.</p>
    <p>Resize this window to view how the images above crop and zoom to display the image best for each viewport size.</p>
  </article> 
</section>
    <div class="button-group">
       <a href="https://www.imgix.com" class="button">Learn More about imgix</a>
    </div>
  </article> 
</section>
<footer>
  <hr>
<a href="https://imgix.com"><img src="https://assets.imgix.net/presskit/imgix-presskit.pdf?page=3&fm=png&w=320&dpr=2" width="160" height="60"></a>
</footer>
            
          
!
            
              body{
  padding:0;
  margin:0;
  text-align:center;
}
            
          
!
            
              imgix.config.host = 'assets.imgix.net';
imgix.config.useHttps = true;
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console