Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Perfumes Preview Card

Kamil Wiater•230
@WiaterKa
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Had problems with a proper positioning of the image (please see the bottom line).

Any feedback concerning the above (and other aspects) hugely appreciated :))

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Sounak Mukherjee•560
    @kanuos
    Posted over 2 years ago

    Hi Kamil, congrats on your submission. Your code looks pretty decent to be honest but like they say - there's always room for improvement.

    Here's a few tips on how to improve your code

    1. Your code is missing the landmark wrapper. Easy fix - convert the div.container to main.container
    2. Looking at your class names, try to follow a standard - eg. BEM. Look up BEM naming convention. That'll help you isolate the UI into minute re-usable components - hence leading to DRY-er code.
    3. Always use an alt attribute to your img element.
    4. Try to make the img styling more generic. The starter kit provided by FEM is kind enough to resize and optimize the images. What if the images were out of shape/aspect ratio? Use object-fit object-position etc props on img elements. Setting the display to block helps prevent a lot of unnecessary bugs.
    5. If you look at the design, you'll see the font weight of the heading element is not optimal in your code. Fix it when you can. While at it, fix the font size of the card description too.
    6. You probably missed out the hover effect on the button. As a pointer, I'd recommend using a <a> tag instead of the button element. Also, decrease the border-radius of the button to make it look identical to the design's button.
    7. If you look at the desktop design, the image on the left and the card info on the right are of the same width. In your solution, the image looks a bit thinner compared to the card info. Also, the padding on the text content is a bit more in the design.
    8. Try using relative units like rem, %, em etc instead of absolute units like px.

    Hope this helps. Hope to see a lot more from you in the future. Happy coding :)

    Marked as helpful
  • Anna P. M.•390
    @annapmarin
    Posted over 2 years ago

    Good job! Maybe you can erase the text-align: justify to fit the original design. Also, regarding the image, you can heighten the image: height: 455px; to fit in better, or you can try adding new properties to the div you named as "img_container".

    Also (but this is less important) you can add more right margin to the <h1> and more line-height and margin-right to the product description <p> to fit more the original design.

    Marked as helpful
  • D. Jaime Blockton•180
    @digigrrl525
    Posted over 2 years ago

    It's looking good. I don't know that I would have used an SVG for the button, but that is a personal choice. Also, you have "Add do Cart" instead of "Add to Cart" as your button CTA.

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
Frontend Mentor logo

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

Oops! 😬

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

Log in with GitHub