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

3 columns challenger solution

bem
Jesus Rebeitte•110
@Rebeitte
A solution to the 3-column preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I have one question:

I learned that I can give a fixed font-size to the document html using Font-size: 62.5% to have 10px and use rems. However some people says that is not correct because the percentage is not the same for all browsers.

My doubt is: What is better to use, px or %?

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

    🎉 Congratulations on finishing this challenge! Regarding your question, for font-size, it is recommended to use rem or sometimes em unit instead of px or %. Also, you don't need to think about how much 1rem is in px. You might find it helpful if you don't think in terms of px at all.

    Also, changing the root font-size can have a lot of negative impacts with almost no benefit. Read what an accessibility expert (Grace Snow) has said about it.

    For the feedback:

    • Accessibility
      • Don't uppercase the text manually, the screen reader will spell it letter by letter. Use CSS instead.
      • Create a custom :focus-visible styling to any interactive elements (button, links, input, textarea). This will make the users can navigate this website using keyboard (Tab) easily.
      • For any decorative images, each img tag should have empty alt="" and aria-hidden="true" attributes to make all web assistive technologies such as screen reader ignore those images. In this case, all images are decorative only.
      • The Learn more button should be a link, since they will navigate the user to the different web page, if this is a real website.
    • Best Practice (Recommended)
      • You can import two font families at once.
    • Styling
      • Setting the box-sizing: border-box; on the html element doesn't make all the elements box-sizing: border-box;. You can make all the elements inherit the box-sizing value from the html by doing the following.
    html {
        box-sizing: border-box;
    }
    
    *,
    *::after,
    *::before {
      box-sizing: inherit;
    }
    
    • To make the cards perfectly in the middle of the page, you can make the body element as a flex container.
    /**
     * 1. Make the direct child element (main)
     *     vertically center and allow the body
     *     element to grow if needed
     */
    body {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh; /* 1 */
    }
    

    That's it! Hopefully, this is helpful!

    Marked as helpful
  • DanielK•440
    @DanK1368
    Posted over 3 years ago

    Hey..i usually apply a font size of 62.5% for the whole project. It's just a bit easier to calculate as 1rem will equal to 10px. Without setting this percentage it will be 1rem=16px.

    You generally want to avoid using px for setting widths and heights, as it will not be responsive to the size of the screen. Unless you really want it to be fixed then you can use px. It depends on what you want to achieve. :)

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