Design comparison
Solution retrospective
Fist project. 1 week into learning to code. I know there is much better ways to do what I have here, I just don'y know what they are.
Community feedback
- @correlucasPosted about 2 years ago
👾Hi @echoturnbull, congratulations on your first solution!👋 Welcome to the Frontend Mentor Coding Community!
Great solution and a great start! From what I saw you’re on the right track. I’ve few suggestions for you that you can consider adding to your code:
1.The image is getting distorted, to avoid this behavior, use these steps, first add
display: block
andmax-width: 100%
to the<img>
selector. To improve the responsiveness even more by adding the auto-crop property you can addobject-fit: cover
to make the image crop inside the container. Here’s the code:img { display: block; object-fit: cover; max-width: 100%; }
2.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.3.You made your html structure entirely with
div blocks
but these div doesn't any semantic meaning, for this reason is better you use a better html markup improving your code, for example for each div img + text content you use<article>
instead of the<div>
.4.Use the tag
<picture>
to wrap the product image inside the html instead of using it as<img>
orbackground-image
(with the css). Using<picture>
you wrap both images (desktop and mobile) and have more control over it, since you can set in the html when the images changes setting the screen size for each image.ote that for SEO / search engine reasons isn’t a better practice import this product image with CSS since this will make it harder to the image.Here’s the documentation and the guide to use this tag:
https://www.w3schools.com/tags/tag_picture.asp
✌️ I hope this helps you and happy coding!
Marked as helpful0@echoturnbullPosted about 2 years ago@correlucas Hi Lucas! Thanks for taking the time to look at my solution, much appreciated!
I had been trying to figure out a better way to wrap everything and if I should import the image through css.
I’ll take a second run at it and see how I go!
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