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 Card Component using SASS

andrewโ€ข 80

@theadg

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


  • Are there better ways I could use better HTML Semantic tags?
  • Are there better ways I could name CSS classes?
  • Are there ways to better optimize my code?

Community feedback

@MelvinAguilar

Posted

Hi @theadg ๐Ÿ‘‹, good job for completing this challenge!

In relation to semantic tags here are some suggestions that you can consider:

  • You can use <picture> tag when you need to change the image on different viewports, using this tag will prevent the browser from loading both images, saving bandwidth and preventing you from using a media query to modify the image . More information here

Example:

<picture>
   <source media="(max-width: 750px)" srcset="./images/image-product-mobile.jpg">
   <img src="./images/image-product-desktop.jpg" alt="your_alt_text">
</picture>

In this solution you should not use the background property to set the image because this image has an important semantic meaning, use CSS background property if the image is not part of the content.

  • The tag <div> is used to defines a section in an website. It is used to have a container styled with CSS, set special alignment or the content needs a special positioning.

You could use more the <p> tag, the <p> element is paragraph level content, usually text:

<p class="card--text-desc">A floral, solar and voluptuous interpretation composed by Olivier Polge, Perfumer-Creator for the House of CHANEL</p>
  • The <h1> element is the main heading in a web page. There should only be one <h1> tag per page, the card--text-footer-price-main should not be an <h1> tag.

  • You could use the <del> tag to display the old price:

<del class="card--text-footer-price-supp">$169.99</del>

Learn more about semantic tags

  • Try to use more descriptive names for your classes, I suggest you learn BEM naming convention standard for CSS class names because increases the readability of front-end code, provides a modular structure, and its more easier to work with.

I hope those tips will help you.

Good Job and happy coding !

Marked as helpful

0

andrewโ€ข 80

@theadg

Posted

@MelvinAguilar Thanks for the feedback bro! Will be updating my 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