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 using Flexbox (Responsive)

Spirit 220

@git-ritesh

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


It's my first ever Challenge Project that I completed with Responsive Design. Responsiveness was the thing that took me a while as I've applied Media Queries in my project for the first time on my own. I watched tutorials and used Media Queries earlier but wasn't comfortable until I made my hands dirty with Media Queries on my own.

Community feedback

@andreimaier

Posted

Congratulations on completing the challenge! You're right that you only learn by doing it yourself! Keep up the good work!

Marked as helpful

2

Spirit 220

@git-ritesh

Posted

Thanks!@andreimaier

0

@jonatasolmartins

Posted

Congrats man! Feel tips, you can the picture element and change the image based on the media query.

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

In the example above the mobile image will be used until the screen get bigger than 600px and then the image is replaced with the image in the source element.

The last tip is to use the before or after pseudo classes to place a svg image on a element.

<button class="add-to-cart">Add to Cart</button>

And then in the css file

button::before {
    content: url(/images/icon-cart.svg);
}

Before means that it will place a content (SVG image in this case) before the first child of the element (my text in this case) The result will be same as if I had put my SVG file/tag in my html but it makes my html more cleaner cause SVG tends to be very big.

My last tip is to look at someone else code after you finished your to get more insights on how to make things better, I do that and learn lots things that I can apply in my next challenge.

Congrats again and happy code!

Marked as helpful

1

Spirit 220

@git-ritesh

Posted

Thank you so much for reviewing my code and giving these awesome tips!@jonatasolmartins i'm gonna use it right away! i'll remember your words "look after someone else's code for more insights" Thanks Again : )

0
Spirit 220

@git-ritesh

Posted

This isn't working for me.

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

Instead of this added both the images inside the <picture> element. And for the Mobile Design i set display:none; to Desktop image & vice-versa for the Desktop Design. @jonatasolmartins

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