Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Product-preview-card-component

@arilthon

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Lucas 👾 104,440

@correlucas

Posted

👾Oi @arilthon, 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, mas se você quiser melhorar ainda mais, você pode usar a tag <picture> para simplificar seu código e segurar as duas imagens dentro do html. Usando essa tag, você nem precisará de media query para mudar de uma imagem para outra dependendo do dispositivo (mobile ou desktop), basta configurar tudo dentro do html.

Caso você ainda não conheça essa tag, aqui na documentação explica certinho como configurá-la: **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 helpful

0

@VCarames

Posted

Hey @arilthon, 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.

  • The Header Element is being used incorrectly and not needed for this challenge.

  • To give you HTML code structure, you want to set up your code in the following manner (only did parent containers):

HTML

   <body>
      <main>
        <article class=“card-container”>
          <picture></picture>
          <div class="card-content">
          </div>
        </article>
      </main>
    </body>

The Main Element identifies the main content of the document.

While the Article Element will serve as the card’s container, because the card represents a complete, or self-contained, section of content that is, in principle, independently reusable.

More info:

https://web.dev/learn/html/headings-and-sections/

  • The Alt Tag Description for the image needs to be improved upon. You want to describe what the image is; they need to be readable. Assume you’re describing the image to someone.

  • This challenges requires you to use two images for different breakpoints. To properly achieve this, you want to use <picture> element.

Syntax:

  <picture>
    <source media="(min-width: )" srcset="">
    <img src="" alt="">
  </picture>

Source:

https://www.w3schools.com/html/html_images_picture.asp

https://web.dev/learn/design/picture-element/

  • The old price is not being announced properly to screen readers. You want to wrap it in a Del Element and include a sr-only text explaining that this is the old price.

Happy Coding! 👻🎃

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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