Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

Responsive -product-preview-component

sass/scss, accessibility
Kamasah-Dickson•5,570
@Kamasah-Dickson
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello guys it has been months now since I refrained from coding due to my final exams. Now I have to learn a lot of things that I have forgotten. Please kindly review my work and suggest some ways that can help me improve. I really appreciate you all.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Melvin Aguilar 🧑🏻‍💻•61,020
    @MelvinAguilar
    Posted almost 3 years ago

    Hi @Kamasah-Dickson, I really like your solution! 👋

    I have been reading about how to use SASS with the BEM naming convention. I have a suggestion that could help. I also see that you have experience in web design, so it's a humble opinion.

    It seems to me that SASS provides a lot of power. However, nesting many selectors could be detrimental if you want to identify which selector is more specific when setting styles.

    For example, if I want to update the font size of your header in ".price" with a media query, due to the specificity of <h2>, this selector would be the most specific:

    .card .card_img img .card_details .pricing .price h2 {
    	font-size: 2rem;
    }
    

    With BEM example:

    .card {
    	&__price h2 {
    		font-size: 2rem;
    	}
    }
    

    BEM and SASS a perfect match

    It is an opinion. If you wish, I can delete the comment sorry for my English

    I hope this helps you

    Marked as helpful
  • Account deletedPosted almost 3 years ago

    Hey @Kamasah-Dickson, some suggestions to improve you code:

    • For this challenge you want to use the Picture Element not the Background Image Property. The Background Image Property is mainly used on decorative images NOT images that add value and serve a purpose.

    Picture Element will allow your to switch between images in different breakpoints and makes your site load faster by saving bandwidth.

    Syntax:

      <picture>
        <source media="(min-width: )" srcset="">
        <img src="" alt="">
      </picture>
    

    Source:

    https://www.w3schools.com/html/html_images_picture.asp

    https://web.dev/learn/design/picture-element/

    • Once you fix the image implementation, you'll want to include an Alt text tag with them. Inside that Alt Tag you want to describe what the image is; they need to be readable. Assume you’re describing the image/icon to someone.

    • There is only one heading in this challenge and that is the name of the perfume, “Gabrielle Essence Eau De Parfum”.

    • The old price is not being announced properly to screen readers. You want to wrap it in a Del Element and include a sr-only text explaining that this is the old price.

    • The "shopping cart" icon is decorative, so its Alt Tag* should left blank and have an aria-hidden=“true” to hides it from assistive technology.

    Happy Coding!

    Marked as helpful

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub