Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Responsive component using tailwind css and the picture HTML tag.

tailwind-css
Nicolás Órdenes•50
@nico-or
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Any recommendations for choosing the spacing between text elements without having to resort to measuring the pixels of each margin?

This time I just used justify-content: space-between and fiddled with the top and bottom margin of the price block, which seemed the most different of all.

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Md5 dalton•1,430
    @md5dalton
    Posted over 2 years ago

    Hello Nicolás Órdenes 👋

    Impressive work with your solution for this challenge 👍

    I've noticed the way you imported your fonts and I suppose there's nothing with since they work just fine. Here's code from Google fonts to import all of them in one link tag:

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Fraunces:wght@500;700&family=Montserrat:wght@500;700&display=swap" rel="stylesheet">
    

    Since you're using more than one font, why not use CSS custom properties:

    :root {
        --font-fraunces: 'Fraunces', serif;
        --font-montserrat: 'Montserrat', sans-serif;
    }
    

    Also the picture element you were referring to:

    <picture>
        <source srcset="./images/image-product-desktop.jpg" media="(min-width: 576px)" />
        <img src="./images/image-product-mobile.jpg" alt="transparent perfume bottle" />
    </picture>
    

    There's nothing wrong with your code, those are just my suggestions. Cheers 👌

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

Oops! 😬

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

Log in with GitHub