Skip to content

Fix: Added max-width to learning path images #6413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Jivi-this-side
Copy link

@Jivi-this-side Jivi-this-side commented Apr 29, 2025

Description

This PR fixes #6411

The issue was that images in the learning paths were taking up the full width of their container, causing them to appear excessively large and unscalable. This PR adds the max-width: 100%; and object-fit: contain; CSS properties to ensure that images are properly constrained and maintain their aspect ratios while scaling proportionally.

Screenshot 2025-04-29 at 6 59 33 PM

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Thankyou ! 🌻

Signed-off-by: Dithi <heydithi88@gmail.com>
@github-actions github-actions bot added the area/learn Related to /learn section label Apr 29, 2025
@l5io
Copy link
Contributor

l5io commented Apr 29, 2025

🚀 Preview for commit 89464ce at: https://6810d3e50ee12c7354263f8d--layer5.netlify.app

@vr-varad
Copy link
Contributor

vr-varad commented Apr 29, 2025

@Jivi-this-side the issue was to add max-width but not 100%, the image are still humongous and issue was to have a maxwidth to keep them smaller even if the screen size increases.
The approach is right just make max-width smaller.

@Jivi-this-side
Copy link
Author

Jivi-this-side commented Apr 29, 2025

@vr-varad Sir, if I set max-width: 600px, would the following CSS:

img{ 
            height: 8.5rem; 
            width: 8.5rem; 
        }  

If i set the max-width: 600px property will not apply because the width is explicitly defined as 8.5rem. This CSS won't behave as intended since the explicitly defined height and width (both set to 8.5rem) override the max-width: 600px, rendering it ineffective. Could you provide further guidance on this?

@vr-varad
Copy link
Contributor

vr-varad commented Apr 29, 2025

You're getting the issue because width: 8.5rem; is forcing the image to always be 8.5rem wide. So even though you wrote max-width: 100%, it doesn’t work — the image won't shrink to fit its container, since the fixed width wins.
@Jivi-this-side

@Jivi-this-side
Copy link
Author

@vr-varad sir ! Apologies for the interruption, but I believe that adding the following inline style:
style="max-width: 500px; height: auto; width: 100%;"
at this location in the file :

<img src={commentingViaDock} width="100%" align="center" />

would effectively constrain the images, causing them to shrink as desired. This approach ensures that the images remain responsive, scaling appropriately within the container while maintaining their aspect ratio.
Should I revert my previous max-width changes and commit this updated change instead? Locally, this styling is producing the intended appearance :
Screenshot 2025-04-30 at 1 18 01 PM

Am I correct in this approach?

@vr-varad
Copy link
Contributor

This looks promising, make a commit @Jivi-this-side will review it and suggest changes if required

@Jivi-this-side
Copy link
Author

@vr-varad Sir, I have resubmitted the changes as per our discussion above. Kindly review them and let me know if they are satisfactory or if any further modifications are needed.
Thank you 🌻

@l5io
Copy link
Contributor

l5io commented May 1, 2025

🚀 Preview for commit 0ed1075 at: https://68131804a673446375d22982--layer5.netlify.app

@vr-varad
Copy link
Contributor

vr-varad commented May 1, 2025

I don't think that worked coz the size of the image if still humongous @Jivi-this-side

…scussion)

Signed-off-by: Dithi <heydithi88@gmail.com>
@l5io
Copy link
Contributor

l5io commented May 1, 2025

🚀 Preview for commit e5f5485 at: https://68135586d20cdb7482e828cc--layer5.netlify.app

@Jivi-this-side
Copy link
Author

@vr-varad Sir,
I sincerely apologize for my earlier oversight. I mistakenly applied the changes to the wrong file, "Reviewing-Designs.mdx." However, I have now corrected this and updated the appropriate file, "Deploying-Meshery.mdx."

I deeply regret any confusion caused and kindly request your review of my latest commit. I am confident that the changes are now implemented correctly and will function as intended.

Additionally, I noticed that two images remain unchanged as they already have an inline style specifying a margin-bottom property. Would you recommend removing this inline style, or should I apply a consistent margin-bottom styling to all images for a more uniform appearance?

Thank you for your patience and understanding. I greatly appreciate your guidance! 🙇🏻‍♀️

@l5io
Copy link
Contributor

l5io commented May 2, 2025

🚀 Preview for commit ac203c4 at: https://6814b18c79547acc414223c9--layer5.netlify.app

@vishalvivekm
Copy link
Contributor

@Jivi-this-side
Thank you for your contribution!
Let's discuss this during the website call today at 5:30 PM IST

Add it as an agenda item to the meeting minutes, if you would :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/learn Related to /learn section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add max-width to images on learnign-paths
4 participants