University of Utah

Row of Resizable Images

Updated on

Row of Resizable Images

This code uses the grid-row class so that when the page is viewed at different widths, the images decrease in size rather than reformat to display vertically. Resize this page to see how it works.

Row of Three Images

Row of Four Images

Code to Copy
<div style="display: flex;">
  <div class="grid-row" style="grid-gap: 5%; margin: 1rem 0; width: 100%;">
    <div class="col-xs" style="padding: 0;">
       <figure style="margin: 0;"><img style="width: 100%;" src="Image Source URL" alt="descriptive text" />
         <figcaption>Image Caption</figcaption>
      </figure>
    </div>
    <div class="col-xs" style="padding: 0;">
    <figure style="margin: 0;"><img style="width: 100%;" src="Image Source URL" alt="descriptive text" />
         <figcaption>Image Caption</figcaption>
      </figure>
    </div>
    <div class="col-xs" style="padding: 0;">
    <figure style="margin: 0;"><img style="width: 100%;" src="Image Source URL" alt="descriptive text" />
         <figcaption>Image Caption</figcaption>
      </figure>
    </div>
  </div>
</div>
Click to copy

Use this code with caution. It is dependent on an Instructure class, but if that class stops working the images will still display in a vertical format if the page is resized.

When using this code, make sure images have the same aspect ratio or they will not align correctly.

  1. Copy the code and paste it into the page in the HTML view.
  2. Switch to design view and add your first image.
  3. Select the image after it's added to the page, and
    1. add descriptive alt text and
    2. change the size to Percentage at 100.
  4. Add the next image and repeat steps A and B.
  5. Add image captions or delete the filler text.
  6. To add more than 3 images in a row, copy and paste the highlighted code above.
  7. Save the page.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Previous Article Image Borders
Next Article Image Code Tutorial