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

HTML, CSS, CSS Grid (justify and align contents)

Leonel•160
@leonellv94
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


-What did you find difficult while building the project? Grid took me a while.

-Which areas of your code are you unsure of? Grid again, i think it wasn´t a good coding even when i finished it.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Lucas 👾•104,160
    @correlucas
    Posted almost 3 years ago

    👾Hello @leonellv94, congratulations for your new solution!

    Remove all margins and do the alignment using the body with min-height: 100vh and flex properties. Note that you don't need to use width: 1440px is only a reference for the size the design was created.

    Here's the changes I did to your code:

    body {
        min-height: 100vh;
        /* width: 1440px; */
        background-color: hsl(212, 45%, 89%);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .boxA {
        display: grid;
        /* width: 1440px; */
        /* height: 900px; */
        justify-content: center;
        align-content: center;
    }
    
    
    

    ✌️ I hope this helps you and happy coding!

    Marked as helpful
  • PhoenixDev22•16,830
    @PhoenixDev22
    Posted almost 3 years ago

    Hi Leonel,

    Congratulation on completing this challenge. Your solution looks great. I have some suggestions regarding your solution if you don’t mind:

    • Use the<main> landmark for the card and <footer> for the attribution, it should live outside the <main>.
    • In my opinion, the alternate text should indicate where the Qr code navigate the user : like QR code to frontend mentor .
    • Never use <div> and <span>alone to wrap a meaningful content. Just keep in mind that you should usually use semantic HTML in place of the div tag unless none of them (the semantic tags) really match the content to group together. By adding semantic tags to your document, you provide additional information about the document, which aids in communication.

    So to tackle the accessibility issue in this challenge, you can <h1> for the class="text1". And you can use <p> for class="text2".

    • Adding rel="noopener" or rel="noreferrer" to target="_blank" links. When you link to a page on another site using target=”_blank” attribute, you can expose your site to performance and security issues.
    • width: 300pxan explicit width is not a good way to have a responsive layout. Consider using max-width to the card in rem instead.
    • Consider using rem for font size .If your web content font sizes are set in absolute units, such as pixels, the user will not be able to re-size the text or control the font size based on their needs. Relative units “stretch” according to the screen size and/or user’s preferred font size, and work on a large range of devices.

    Hopefully this feedback helps.

    Marked as helpful
  • David•7,960
    @DavidMorgade
    Posted almost 3 years ago

    Hello Leonel, congrats on finishing the challenge!, great job as a first project

    Don't first overwhelmed with grid and flex-box, time will improve your skills and you will se how you will get much better at it, here is my little recommendation to get better at flex and grid.

    First of all there is a vid from, Kevin Powell that gives a nice introduction to Grid, take a look at it! its really worth it. You should also checkout two games that can help you with flex and grid, this are flex-box-froggy and grid-garden, try them, they are good material to improve at those particular css properties!

    Hope my feedback helps you! I encourage you try more challenges and keep going with the practice, good job.

    Marked as helpful
  • Tesla_Ambassador•3,070
    @tesla-ambassador
    Posted almost 3 years ago

    Hey Leonel! Great solution it's looking pretty sharp 👌 I took a peek at your code and it's actually neat, don't beat up yourself too much on that. I also had a hard time writting proper css when I started out. It gets better with more and more practice. Also I like how you are using grid for your layouts, you are among the rare breed 😎

    • In anycase, if you prefer using grid for your layouts, it's better you apply it to the parent container and then you use flex for the container's contents. To learn more about grid and how to use it, you might want to check this out css grid.
    • In order to resolve some of your accessibility issues, you might wanna use landmarks in your html code, these help browsers easily navigate your code. So you might consider wrapping your divs in landmarks like <main> or <header> or <footer> you need to do this according to how your page is structured. Incase you want to know more about landmarks, follow this link.
    • You might also want to add a little bottom-padding to your div with the class attribution so that it's not so much at the bottom border. It'll make the solution look a little neater. Keep up the great work and keep on coding!😎
    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, 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