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

Responsive Product Preview Card Component using flexbox and CSS

Brian Carlo Birondo•320
@Briancarlo24
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Please let me know what I could improve on my code?

Happy to hear any feedback in general :D

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Alamin•1,980
    @CodeWithAlamin
    Posted over 2 years ago

    Hi Brian Carlo Birondo👋 Great job on completing this challenge! 🥳

    I would like to share a few suggestions on this solution if you don't mind.

    • One thing that could be improved is the use of CSS variables. Instead of hardcoding colors throughout the stylesheet, you could define them as variables at the beginning of the stylesheet and then use the variables consistently throughout the stylesheet. For example, instead of using hsla(212, 21%, 14%, 0.5) for the product and product-desc styles, you could define a variable called --very-dark-blue at the beginning of the stylesheet and use var(--very-dark-blue) for the product and product-desc styles. This would make it easier to maintain and update the color scheme of the website.

    • Another improvement that could be made is the use of semantic HTML elements. Currently, the product name and description are both styled as <p> elements, which is semantically correct for text content. However, the title of the product is styled as a <h1> element, which is generally reserved for the main heading of a page. Instead of using a <h1> element, it might be more semantically appropriate to use a <h2> or <h3> element for the product title. This would give more context to the structure of the page and make it easier for screen readers and other assistive technologies to interpret the content.

    • One final suggestion for improvement is the use of responsive design techniques. Currently, the page has a fixed width of var(--container-width), which is set to 80rem. This means that the page will always take up the same amount of space on the screen, regardless of the size of the viewport. Instead of using a fixed width, it would be more user-friendly to use a responsive layout that adjusts to the size of the viewport. This could be achieved using CSS grid or flexbox layouts, as well as media queries that adjust the layout and styles for different screen sizes. This would allow the page to be easily viewed on a wide range of devices, from desktop computers to smartphones.

    Overall, this is a very well done solution to the challenge. Great job!

    I hope this feedback was helpful. 😊 Keep up the good work!👍

    Marked as helpful
  • Paweł Pohl•390
    @Pawel1894
    Posted over 2 years ago

    Hey! Great job finishing this challenge.

    Here is some feedback from me

    • It is important for search engines to keep correct html syntax. You should put your section inside <main></main> tags and footer inside <footer></footer> tags

    • To get image looking simillar to frontend mentor design i would recommend you changing it to background-image instead of <picture>. Then instead of using flex just use grid and make it 2 columns od desktop resolutions, it will automatically adjust image size to height of content on the right side.

    • Give it lower max-width so it won't be that big, and work a bit on font-sizes and bigger spaces between elements.

    If you need some help you can always dm me on discord Paaaweł#7660 or lookup my solution for this project I think it is very close to design.

    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
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