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

QR Code Component using HTML & CSS

aisi•10
@aisyelo
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I found this one hard to position below the card:

 <div class="attribution">
        Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>. 
       Coded by <a href="#">Aisi</a>.
   </div>

I styled it this way, however it's layout changes as the screen resizes:

.attribution{
    display: flexbox;
    align-items: center;
    position: absolute;
    right: 0;
    left: 0;
    bottom: 10;
    padding: 0.5rem;
    text-align: center;
}

I would like to ask what are the proper ways on how to fix it. Thank you.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

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

    Hi, @aisyelo!

    First, you need to know that display: flexbox is an invalid value of the display property. If you want to make it as a flex container then it should be display: flex.

    Then, I don't recommend using absolute positioning. I recommend following what @Remy349 has suggested which is to make the <body> element as a flex container. Then, change the flex-direction to column to put the attribution below the card.

    Making the <body> element a flex container will make both the card and the attribution gets to the middle of the page.

    After that, you can add some margin-top on the attribution to give some space above it.

    Next, you should remove overflow: hidden from the <body>. Right now, if the card is not on the viewport then the users can't scroll to see the rest of the card.

    Remove all the <br> elements inside <p> elements. Screen readers may announce them as "break" which creates unnecessary noises. You should control the line break by adjusting the padding of the parent element.

    Also, "Improve your front-end skills by building projects" should be <h1> instead of <p>.

    Remove max-width: 1440px. You should not make all elements have that styling. It can create unexpected results with no benefit.

    I hope this helps. Happy coding! 😄

    Marked as helpful
  • Santiago Moraga Caldera•710
    @Remy349
    Posted over 2 years ago

    Hi @aisyelo, great job completing the challenge, a very good result!!!!!

    Just a few tips for you to take into consideration for future projects:

    To solve your problem you can center all the elements using "display: flex" in the "body", remove all the padding and margin you added, you can also remove the "position: relative" and "position: absolute" so it doesn't interfere in the styles. Now just add these styles to the "body"....

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

    This should be enough to fix your problem.

    Again, congratulations on completing the challenge, keep learning :)

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