Design comparison
Solution retrospective
Any feedback is appreciated. Using an image in a flexbox was a bit tricky when it came to responsive design, as preserving the correct ratio of an image was not easy at different widths. I've included therefore tablet version as well. I wanted to have in the desktop version, an flexible image size, while for tablet and mobile fixed image size. So when i added fixed max-widths to image size in that browser-width range, i couldn't get an flexible image on desktop version that keeps also the flex ration (flex: 56% for img, flex: 44% for text-block). I ended up doing fixed image sizes for all version, but if has a suggestion about how to have flexible image that grows and shrinks on desktop version and still have fixed image size in mobile version, please let me know. thnx
Community feedback
- @FarisPalayiPosted over 3 years ago
Wow, site layout responds really well with different screen sizes. Nicely doneπ
I don't know if it is applicable to your solution, but a classic solution is to make an image responsive is by adding this css properties to the img. And it doesn't mess up the aspect-ratio of the image.
.responsive { width: 100%; height: auto; }
Also, you can use the picture and source tags and srcset attributes to change the images according to your needs. For example, different images for different media queries.
And also, if the image doesn't provide a context to your site, you can use the
background-image
css property to set it as background image. Also, it is really flexible.Here's a bunch of links that might help you: w3schools, MDN, developers.google, css-tricks.
Have fun coding β¨
Marked as helpful0@visualdennissPosted over 3 years ago@FarisPalayi thanks a lot for your detailed answer and the links! What i generally wanted to avoid was actually that the image gets 100% or quite big in tablet version, because then no text is visible on the page, so from user point of view, seeing only an image with illustration and brand-logo might not give much clue to the user what the website is about, so i wanted to at least a part of text always visible in any version. Therefore i had to do fixed width or height.
But once i've done that to tablet version and when i set width: 100%; height: auto; (as you suggested) in the desktop version, it made image oversized and either text or image started to overflow the div. Thats why using only percentage approach did not work for me. I'll look further into those links you have shared, thanks again!
1 - @NebiyouErsaboPosted over 3 years ago
looks great! try to include the social media link/icons in the footer tho
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord