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 Card

ParthUONā€¢ 100

@ParthUON

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


What are you most proud of, and what would you do differently next time?

I take pride in implementing the clamp() function to achieve responsive typography. Looking forward, I would enhance my approach by exploring additional techniques for even more versatile and dynamic designs.

What challenges did you encounter, and how did you overcome them?

I faced challenges adapting images for mobile and desktop, but I overcame them by utilizing CSS's content feature within img tags, ensuring a responsive solution.

What specific areas of your project would you like help with?

animation and parallax effect

Community feedback

@Ikuewumi

Posted

Hi @ParthUON. Awesome Project šŸ‘

About your question, I was impressed by the use of the content property, I always thought it was only used in pseudo-elements. But the answer here would be to use the picture element,

This is an example

<picture>
    <source srcset="...desktop.jpg" media="(min-width: 40rem)">
    <img src="...mobile.jpg" alt="">
</picture>
picture {
    display: contents;
}

picture img {
    width: xrem;
    // more
}

What happens is that the browser switches out the src of the image when it hits a specified media query

A caveat though is that the content that is shown is only the image tag, so I would suggest, putting any styles on the image tag

You can learn more about the picture tag on the MDN docs

And btw what do you need parallax for?

Happy Coding, Ayobami

Marked as helpful

1

ParthUONā€¢ 100

@ParthUON

Posted

@Ikuewumi thank you for your advice. i will keep in mind next time. i want to create my portfolio website using parallax effect.

0
Daniel šŸ›øā€¢ 37,990

@danielmrz-dev

Posted

Hello @ParthUON!

Your project looks great!

I have a suggestion about your code that might interest you:

šŸ“Œ You can use the <picture> tag when you have different versions of the same image.

Using the <picture> tag will help load the correct image to the user's device, saving bandwidth and improving performance.

Example:

<picture>
    <source media="(max-width: 460px)" srcset="{desktop image path here}">
    <img src="{mobile image path here}" alt="{alternative text here}">
</picture>

I hope this helps!

Other than that, excellent work!

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