Design comparison
Solution retrospective
Difficulties on this challenge:
- How to manage height of the image on the mobile screen ? (i have used flexbox but i haven't reached the result i was expecting)
Solution i have used: increase height of my parent card (pass from 780px to 800px on mobile).
Is there a better solution ?
Community feedback
- @correlucasPosted about 2 years ago
👾Hello @devwinner-sek, Congratulations on completing this challenge!
I saw your preview site and I liked a lot the work you’ve done here, it's almost complete, I’ve some suggestions you can consider applying to your code:
1.Use
<main>
instead of<div>
to wrap the card container. This way you show that this is the main block of content and also replace the div with a semantic tag.2.Use units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.3.Something you can do to improve the image that needs to change between mobile and desktop is to use
<picture>
instead of<img>
wrapped in a div. You can manage both images inside the<picture>
tag and use the html to code to set when the images should change setting the devicemax-width
depending of the device (phone / computer) Here’s a guide about how to usepicture
:https://www.w3schools.com/tags/tag_picture.asp
✌️ I hope this helps you and happy coding!
Marked as helpful1@devwinner-sekPosted about 2 years ago@correlucas Thanks very much for your suggestions. I have a great issue with responsive using only HTML + CSS. My goal is to master HTML CSS (i used bootstrap before).
Once again, thanks.
0@devwinner-sekPosted about 2 years ago@correlucas Please a question:
I saw the case i can use picture : <picture> <source media="(min-width:650px)" srcset="img_pink_flowers.jpg"> <source media="(min-width:465px)" srcset="img_white_flower.jpg"> <img src="img_orange_flowers.jpg" alt="Flowers" style="width:auto;"> </picture>
It's very helpful.
But please i have a question:
By using img in HTML, can i give a background color to the image ?
I have used background image in this challenge because of the issue of background color for the image:
.card-right { border-radius: 8px 8px 8px 8px; background-image: url("../images/image-header-mobile.jpg"); background-color: #aa5cdb; background-blend-mode: multiply; background-repeat: no-repeat,repeat; }
0@correlucasPosted about 2 years ago@devwinner-sek is the same thing you can use
img
to apply the color to the image using the main selector for the image instead of usingbackground-image
its also better to do it usingimg
than the css.Marked as helpful0 - @TheMax370Posted about 2 years ago
Hi Sek congrats on completing your challenge to answer your question, if there is a better solution? yes there is, instead of using absolute lengths you should look about relative lengths and learn how to use max-width, min-width, max-height and min-height this will help you in the future to make your containers more responsive and will save you a lot of resizing on the media queries I hope that answer your question.
Marked as helpful0
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