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

I just used html and Css

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

Solution retrospective


how can i put the box in the middle of the center?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Jeje•2,050
    @AkoToSiJeromeEh
    Posted about 2 years ago

    Hi there! Great work out there! I noticed that the QR Code component is not vertically aligned, and I recommend adding CSS properties to the body, such as d-flex and its related properties. Additionally, it's important to include min-height or height for proper alignment. By adding this to the body properties, you can achieve centering of the QR Code component. Furthermore, when we look at the design reference, the paragraph element is aligned at the center of the container. Therefore, I recommend adding text-align: center to section#caixa. I hope this suggestion helps and works for you. Happy coding!

    body {

    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    font-family: Arial, Helvetica, sans-serif;

    background-color: #D5E1EF;

    font-size: 1.75em;

    text-shadow: 2px 2px 5px lightgrey;

    line-height: 40px;

    }

    Marked as helpful
  • Ken•220
    @kensparby
    Posted about 2 years ago

    You're off to a good start, Gabriel! Looks good, with semantic tags and all, and you got it very close to the example image.

    One small tip, don't use the vh (viewport height) unit for things like padding. It may look good on your screen, but if for instance someone used a vertical screen instead it might look very wonky to them, as if the padding is too big. You can see this for yourself by zooming the page out (Ctrl + Mouse scroll) which effectively simulates an increased viewport height.

    A better unit for this might instead be rem, which is based off the font size of the root element, which on the web is the <html> element. This is easier to control for both developer and user, and ensures that things will look properly scaled relative to the text.

    Oh, and for your question. As Akiraz14 mentioned already this is easily done with flexbox, but you will also need to ensure that the <body> element is tall enough. By default it's only as tall as the elements within it, so centering inside it will seem to have no effect. Use e.g. min-height: 100vh; to achieve this.

    Good luck! Ken

    Marked as helpful
  • Akiraz14•50
    @Akiraz14
    Posted about 2 years ago

    Hello Gabriel, I think your page seems great, is a very good approximation to the original model.

    Answering your question about centering the box, you can do it with just 2 lines of code in the CSS code!

    You just have to use 'flexbox', I recommend some reading and also to make your learning process more interesting the Froggy flexbox website which is a didactic game.

    • https://css-tricks.com/snippets/css/a-guide-to-flexbox/
    • https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox
    • https://flexboxfroggy.com/#es
    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.

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