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

Responsive price grid component built with html css flexbox

Andrew Saganda•50
@asaganda
A solution to the Single price grid component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello - I'd like feedback on how i could better vertically center the "per month" copy next to "$29" under "Monthly Subscription"? How have others written the html markup? I used a paragraph tag to contain that sentence but maybe i should use another tag instead Feedback is welcome Thanks

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Vanza Setia•27,715
    @vanzasetia
    Posted over 3 years ago

    Hi, Andrew! 👋

    Congratulations on finishing your first Frontend Mentor challenge! 🎉 It's great that you made the site responsive using the mobile-first approach! Good job! 👍

    Regarding your question, when I did the challenge I wrapped the $29 on its own span. So, if you want to follow my approach then I recommend wrapping the $29 text with a span and the make the p element as the flex container to align the per month text center vertically.

    <p class="subscription__price">
      <span class="subscription__number">$29</span>
      <span class="subscription__month">per month</span>
    </p>
    

    You've used the correct HTML markup by using a paragraph tag as the main element to wrap those text. The text only makes sense if those are read together (or as one paragraph) by screen readers. So, you are on the right track. 👍

    One thing that is worth fixing is the background color for the Sign up link on the hover state. I believe it should be a lighter color than the original state. The black color is not match the color scheme of the page (at least in my opinion).

    That's it! I hope this information is useful! 😁

    Marked as helpful
  • Travolgi 🍕•31,300
    @denielden
    Posted over 3 years ago

    Hi Andrew, great work on this challenge! 😉

    Here are a few tips for improve your code:

    • add main tag and wrap the card for improve the Accessibility
    • to smooth also the bottom angle add overflow: hidden to container class
    • remove all margin from container class and body
    • use flexbox to the body to center the card. Read here -> best flex guide
    • after, add min-height: 100vh to body because Flexbox aligns child items to the size of the parent container
    • add transition on the element with hover effect
    • instead of using px use relative units of measurement like rem -> read here

    Overall you did well 😁 Hope this help!

  • T.Praveen•870
    @gwtpraveen
    Posted over 3 years ago

    hi Andrew Saganda, good job completing this challenge

    in terms of accessibility issues simply wrap all content between main tag and you should have one level one heading h1 tag

    keep up the good work...!

  • Shashree Samuel•8,860
    @shashreesamuel
    Posted over 3 years ago

    Hey good job completing this challenge

    Keep up the good work

    Your solution looks great however I think that the card needs a bit of margin from the top using margin-top.

    I hope this helps

    Cheers

    Happy coding 👍

  • Prabhash Ranjan•2,540
    @besttlookk
    Posted over 3 years ago

    hi, Any time you need to center, you can use flexbox. Like to make your content center w.r.t screen, you can do this:

    body{
      display:flex;
      justify-content:center;
      aligned-items:center;
      min-height: 100vh;
    }
    

    Good luck

    Happy Coding

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

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