Skip to main content
Inspiring
July 6, 2022
Question

3 responsive images in a row - one displays smaller than other two

  • July 6, 2022
  • 15 replies
  • 1940 views

The question is for a row of three images, the first image is displaying smaller than the other 2 when viewport begins to flex to smaller breakpoint (around 1199px).

 

.picsMaxWidth {

width: 100%;
height: auto;
max-width: 277px;

}

 

Not sure how to resolve.

If I change rule to .picsMaxWidth img, it does even out; however, responsiveness stops.

 

This topic is closed to new replies. Start a new post to keep the conversation going.

15 replies

Nancy OShea
Community Expert
Community Expert
July 6, 2022

For better answers we need to see the HTML code.

 

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
July 6, 2022

What is the native size of each image?

 

Max-width does not change the native image size beyond it's natural width in pixels.

 

So if image A is 100px and image B is 72px, the max-width of both images will be as wide as the parent container but no more than 100px for image A and 72px for image B.

 

 

 

Nancy O'Shea— Product User & Community Expert
r_tistAuthor
Inspiring
July 8, 2022

216px x 159px - same size for all three.

 

This is the code for that area in question, tucked within a responsive table:

   .table {width: 100%; max-width: 100%; margin-bottom: 20px;}

 

<tbody>
<tr>
<td><img class="picsMaxWidth" src="images/product5.jpg" alt="5"></td>
<td><img class="picsMaxWidth" src="images/product15.jpg" alt="15"></td>
<td><img class="picsMaxWidth" src="images/product50.jpg" alt="50"></td>
<td></td>
</tr>

</tbody>

Nancy OShea
Community Expert
Community Expert
July 8, 2022

Sorry but Tables are NOT responsive.  At some point they invariably break down due to borders & cell padding and the max-width limits you imposed.

 

Do yourself a favor and ditch the table. If you require a layout container for images, use CSS Flexbox or Grids.

 

Nancy O'Shea— Product User & Community Expert