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 component using Flexbox

Kevin H.ā€¢ 150

@kevinx9000

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


I started with desktop design first and then adjusted by using @media to create the mobile layout. That was probably the biggest challenge is fixing the layout for the breakpoint. Since separate images were provided for the desktop and mobile view (as opposed to using the same image and making that element responsive), I had to play with adding both images to the HTML document and then using display in CSS to switch them on or off for the responsive views.

Community feedback

@0xabdulkhaliq

Posted

Hello there šŸ‘‹. Congratulations on successfully completing the challenge! šŸŽ‰

  • I have other recommendations regarding your code that I believe will be of great interest to you.

DECORATIVE SVG'S ā™Øļø:

  • The alt attribute is used to provide alternative text for images in HTML documents. The alt attribute is used by screen readers to describe the image to visually impaired users, which is essential for web accessibility.
  • Now, when it comes to decorative SVGs, they are used purely for aesthetic purposes and do not convey any important information or functionality to the user.
  • Since these images do not convey any important information or functionality, there is no need for an alt attribute.
  • So feel free to set the alt attribute as "" for decorative svg's, because alt="" will be skipped by screen readers they will consider the image as decoration

Example:

<img src="images/decorative.svg" alt="">

<img src="images/icon-cart.svg" alt="cart icon">
šŸ‘‡
<img src="images/icon-cart.svg" alt="">

.

I hope you find this helpful šŸ˜„ Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

0

Kevin H.ā€¢ 150

@kevinx9000

Posted

Thank you for taking a look, @0xAbdulKhalid ! I will have to remember that balance going forward between images that are vital content vs. simply decorative.

0
Donā€¢ 220

@coffeeslammer

Posted

Here's a nice way of fixing that

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

(use what ever class name you like) Once the image gets to the size its set to it will switch to in media (mine 39.75rem) the srcset replaces the image without any css code

You should also always start mobile first. Makes it way easier

Marked as helpful

0

Kevin H.ā€¢ 150

@kevinx9000

Posted

Thank you for taking a look, @coffeeslammer ! I'm not familiar with the <picture> tag yet, so that will give me something to study.

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