Design comparison
Community feedback
- @correlucasPosted about 2 years ago
👾Oi @robsongomes, tudo bem? Parabéns pelo desafio! Seja bem vindo a comunidade do Frontend Mentor
Acabei de ver sua solução e tenho umas dicas pra melhorar seu código/design:
A sua solução ficou muito boa, a estrutura html o design também, algo que você pode fazer para melhorar a imagem que precisa mudar entre mobile e desktop é usar
<picture>
ao invés de<img>
dentro de uma div. Por motivos de SEO e mecanismos de pesquisa tipo Google e bing, não é uma boa prática importar esta imagem do produto com CSS, pois isso dificultará a localização da imagem no google. Você pode gerenciar ambas as imagens dentro da tag<picture>
e usar o código html para definir quando as imagens devem mudar configurando o dispositivomax-width
dependendo do dispositivo (mobile / desktop) Aqui está um guia sobre como usarpicture
:https://www.w3schools.com/tags/tag_picture.asp
Veja o exemplo abaixo:
<picture> <source media="(max-width:650px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="Gabrielle Parfum" style="width:auto;"> </picture>
👋 Espero que essas dicas te ajudem e que você continue no foco!
Marked as helpful1 - @VCaramesPosted about 2 years ago
Hey @robsongomes, some suggestions to improve you code:
- Implement a Mobile First approach 📱 > 🖥
With mobile devices being the predominant way that people view websites/content. It is more crucial than ever to ensure that your website/content looks presentable on all mobile devices. To achieve this, you start building your website/content for smaller screen first and then adjust your content for larger screens.
-
Change the
width
of your component container tomax-width
to make it responsive. -
The button's hover color is incorrect. Currently, it is a dark blue, when it should instead be a dark green.
-
Your price is missing the dollar sign.
Happy Coding! 👻🎃
Marked as helpful1 - @MelvinAguilarPosted about 2 years ago
Hi @robsongomes 👋, good job for completing this challenge and welcome to the Frontend Mentor Community! 🎉
This is a good solution for this challenge and here are some suggestions you might consider to improve accessibility:
- You can use
<picture>
tag when you need to change the image on different viewports, using this tag will prevent the browser from loading both images, saving bandwidth. More information here
Example:
<picture> <source media="(max-width: 600px)" srcset="images/image-product-mobile.jpg"> <img src="images/image-product-desktop.jpg" alt="your_alt_text" class="product-image"> </picture>
- You could use the <del> tag to display the old price:
<del> <span class="sr-only">Old price: </span>$169.99 </del>
Note that I added the <span> with the
sr-only
class to thedel
element, this will provide more information about what your old price is about.The
sr-only
class is a class that you can add to hide content visually but is only visible to screen-readers:.sr-only { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
- The cart icon is for decoration purposes only, so it can be hidden from screen-readers by adding
aria-hidden="true"
and leaving its alt attribute empty:
<img src="images/icon-cart.svg" alt aria-hidden="true">
I hope those tips will help you.
Good Job and happy coding !
Marked as helpful1 - You can use
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