Skip to content

Commit

Permalink
added auto size to images
Browse files Browse the repository at this point in the history
  • Loading branch information
Ganavh000 authored Feb 11, 2024
1 parent 8e12d1c commit 5b4d322
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ function populateSection(data) {

const image = document.createElement('img');
image.src = item.image;
section.appendChild(image);
image.style.maxWidth = '100%'; // Set maximum width to ensure images don't exceed container width
image.style.height = 'auto'; // Maintain aspect ratio

const description = document.createElement('p');
description.textContent = item.description;

section.appendChild(image);
section.appendChild(description);

sectionContainer.appendChild(section);
Expand Down

0 comments on commit 5b4d322

Please sign in to comment.