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

Responsive Product Preview Card [Picture Element, Flexbox]

@MalexLucero

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


If you used the <picture> element, did it render as content along with the image in your browser. How did you overcome the obstacle it created?

If the element did not render, what browser were you using?

Community feedback

Lucas 👾 104,440

@correlucas

Posted

Hello Manuel, congratulations for your solution!

I didn't get your question, I saw your solution and the picture is working normally. I don't think you'll have problems using this tag at this point almost all browsers fully supports the element. You'll problems only with outdated browsers, but I think this will happen only in minor cases.

You can check the <picture> compatibility here: https://www.w3schools.com/tags/tag_picture.asp

About your solution, there's only one aspect I think you can think about fixing, using max-width instead of width, if you check your solution, after the page become mobile, when it reach width 300px the card has the width fixed and doesn't behave as flexible box.

I hope it helps you bro, keep it up!

Marked as helpful

0

@MalexLucero

Posted

@correlucas Very helpful. Thanks for the suggesting Lucas!

1
Elaine 11,400

@elaineleung

Posted

Hi Manuel, yes, I was able to use the picture element for this challenge, and it turned out fine for me on Firefox and Firefox Developer. You can check out my solution here: https://www.frontendmentor.io/solutions/card-component-using-cube-css-tNaBY0y_Nx

I also used it in another project I had built with React: https://www.frontendmentor.io/solutions/intro-section-with-dropdown-nav-built-with-react-using-vitejs-YegOSGfTJ_

I just had a look at your code; if you're having issues, it might be because of the way the 686w width markers that are in srcset; the way it's written is a bit different than using one <img> tag with different sources. Try deleting the 686w and 600w and see whether it helps. You also don't need the width attribute in the <img> tag.

Good luck, hope this helps!

Marked as helpful

0

@MalexLucero

Posted

@elaineleung Hi Elaine, thanks for your feedback. You're absolutely right. I did miss the width property on the image tag. I took a look at the project you did in react, and wow. I am blown away. Great job! I have a lot more to learn about the picture element for sure. :)

1
Elaine 11,400

@elaineleung

Posted

@MalexLucero Thanks for the compliment, Manuel! 🙂

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