Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Product preview card component (Made with HTML5 & CSS3)

accessibility
Caio Schwab Moitinho•70
@CaioSchwab
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


This is my second project, i made with HTML 5 & CSS 3!

i accept every advices and i will be very thankfull because of you help! :)

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

  • Lucas 👾•104,160
    @correlucas
    Posted over 2 years ago

    Fala Caio, beleza?

    Tenho duas dicas pra você.

    Pra você padronizar todas suas imagens, deixando elas responsivas e croppando quando a tela começar a diminuir você pode usar esse padrão aqui:

    img, picture {
    display: block;
    max-width: 100%;
    object-fit: cover; // isso aqui vai fazer a imagem começar a cortar dentro do bloco pra adaptar ao tamanho da tela.
    }
    

    Pra você espaçar os elementos com consistência, te recomendo a separar todos usando padding-bottom desse jeito quando você for mudar os espaçamentos vc vai saber que é sempre o padding abaixo de cada elemento a ser mudado, pq se vc usar padding top/bottom fica mais dificil mudar depois. Use o GAP só quando o espaço entre todos elementos filhos dentro do flex parent forem iguais.

    Não use width: 600px no main pq vc limita o tamanho do bloco todo a 600px e ele não vai diminuir, use max-width: 600px que isso significa que ele vai ter 600px no máximo mas pode diminuir dependendo da tela, entende?

    Se vc quiser dar uma olhada na minha solucao pra vc entender todas essas coisas que falei anteriormente, já aplicadas aqui tá o link: https://www.frontendmentor.io/solutions/product-preview-card-vanilla-css-and-custom-hover-state-on-hero-dVGWpOTgWS

    Continue no foco ai! P cima

    Marked as helpful
  • Adriano•42,870
    @AdrianoEscarabote
    Posted over 2 years ago

    Fala Caio, beleza?

    Gostei bastante do resultado do seu projeto, para o seu segundo desafio tudo está muito bom, parabéns.

    Tenho algumas dicas que julgo que você ira gostar.

    Primeiro gostaria de ressaltar que o uso de classes não é uma má prática, mas para um código que não é tão grande não é legal ficar nomeando todos os elementos com classe isso acaba dificultando a modificação do código css, uma dica para usar quando for decidir se irá usar classe ou não é pensar se há mais de um elemento do mesmo tipo na página, se sim, a classe será uma boa escolha para ter controle dos dois elementos de forma independente!

    Observei que você usou um alt="icon cart" na imagem de carrinho dentro do botão, uma dica que eu daria é para deixar vazio, e adicionar o atributo aria-hidden="true". As imagens devem tem um 'alt=""' a menos que seja uma imagem decorativa, para qualquer imagem decorativa cada tag img deve ter atributos 'alt' vazios e adicionar aria-hidden="true" para fazer todas as tecnologias assistivas da Web, como leitor de tela ignorarem ela! Aprenda as diferenças entre imagens decorativas/sem sentido e conteúdo importante.

    Uma dica que recebi que me ajudou muito e gostaria de compartilhar, é esse jogo: FLEXBOX FROGGY. Ele irá ajudar muito se você ainda estiver aprendendo 'flex-box'.

    Notei que em resoluções menores em algumas partes você usou medidas absolutas, prefira fazer isso quando estiver fazendo a responsividade. Use sempre unidade de medidas relativas para fazer com que o conteúdo se adapte em resoluções menores, e não quebre! Se quiser usar uma largura máxima para evitar que o conteúdo não estique tanto use:

    example {
      max-width: 600px;
      width: 100%;
    }
    

    Fazendo isso teremos um conteúdo adaptável á resoluções menores. Isso se encaixaria muito bem com os dois filhos da tag 'main'.

    Espero que tenha ajudado!

    Marked as helpful
  • Swing95•180
    @Swing95
    Posted over 2 years ago

    Hello,

    nice solution.

    For media queries you can just state differences to code above and you don't have to write whole code again.

    Differences will be based on choosing mobile or desktop first approach.

    I see you have avoided using footer, probably because you could not get rid of it on the right side, when you used flexbox. You can stick it to the bottom by using this CSS:

    footer {
      position: absolute;
      bottom: 0;
    }
    

    You can also use variables for colors etc. Example:

    :root {
        font-family: 'Raleway', sans-serif;
        font-size: 14px;
        --gradient-bar: linear-gradient(to right, hsl(6, 100%, 80%), hsl(335, 100%, 65%));
        --pale-blue: hsl(243, 100%, 93%);
    }
    

    Then go with this in certain selector color: var(--pale-blue); So you do not have to always search for colors.

    Good luck! :-)

    Marked as helpful

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit 1st-party linked stylesheets, and styles within <style> tags.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub