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

Responsive flex layout card

accessibility
Funsho Ayobanjo•150
@ayobanjo
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I think my media query is a bit shaky when going from desktop to mobile. There were spill outs. How can I handle this better?

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted almost 3 years ago

    Hi

    The preview site link isn't working on this? I can give feedback but it's waaaay easier if I can view in browser

    With HTML:

    • You've commented out the picture element. Why? That's exactly what you should be using here
    • Perfume should be in a paragraph tag and have letter spacing applied in css, not extra spaces in html
    • This card only has one heading element - the name of the perfume. Headings are the most important elements for giving your web document semantic structure (like any document, or a book with contents page - that's what headings are for). It's really important you don't misuse or misorder heading elements
    • the new price is not a heading
    • the old price needs wrapping in a <del> tag and some sr-only text adding before it to make it clear it is the old price, as screen readers are not told when text is styled with a line through it.
    • The attribution should be in a footer element

    With the CSS

    • Font size should never be in px - use rem
    • remove max width 1440px
    • did you mean to add a min-height of 100vh to the body? That's what will center it for you on desktop screens
    • Not sure why you have padding on the body and margin on main and 90% width on something (?) You only need one of these techniques if the purpose is to prevent the component hitting screen edges on smaller screens
    • Try to name classes better. _1 and _2 etc will be hard for your future self to understand
    • Min-width 376px is really really small to make a switch to the desktop layout! You should only be switching layout when there is room for it to change.
    Marked as helpful
  • Hyron•5,870
    @hyrongennike
    Posted almost 3 years ago

    Hi @ayobanjo,

    Nice job on your first attempt of the challenge

    You can remove the max-width: 1440px on the body by doing this the card will be in the middle of the page.

    The below is for mobile and will the stack the image and content.

    main.main > div {
        width: 100%;
    }
    
    main.main {
        flex-direction: column;
    }
    

    Hope this is helpful.

    Marked as helpful
  • Lea•160
    @Hatchino
    Posted almost 3 years ago

    Hi. First, the r of "perfume" is missing. It also lacks the letter-spacing property which allows you the spacing between lines for your paragraph. The icon is not the same as on the model. Your responsive is not adjusted between 440px and 374px (the price exceeds the card). Adding styling to the attribution is just my opinion.

    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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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