Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 7 months ago

QR Code with HTML and CSS

P
ImposterCodeVault•90
@ImposterCodeVault
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

This was a basic attempt, that I will compare accounts other solutions to improve upon

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • benssssss•380
    @benssssss
    Posted 7 months ago

    Hello, For the first tempt you do very good

    You can do little changes like

    1 - Center the card vertically

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

    display: flex; will make a flex container, so you will be able to move div childs,

    When using display: flex; it has a property auto defined that will make the elements inside stay side-by-side, like display: inline; to change you use, flex-direction: column; to make elements positioned in column,

    Your body have a setted height, same as the card, so to your center the content you need define a full height to the body, using height: 100vh; vh is viewport who will give the same height of your screen,

    then justify-content: center; will center the content horizontally

    2 - You can use a css file You have styled the page using , this is not very good because on a bigger code you will lose yourself, instead use a .css file and create a link on your html, will make you code cleaner

    3 - browser auto margin Browsers have a default config of margin, padding, font-size, so you need make a reset on it, so you can apply only style you want, you can use another .css file, like (reset.css) or even in you main .css file

    its like

    * {
        margin: 0;
        padding: 0;
    }
    
    • is a selector that select everything in you html margin and padding: 0 will define a 0 value, so you can style as you wish after on you .css styles

    4 - You use google fonts to import the used font, this is very good, and used variables what is very good too,

    Keep the good work!

    Marked as helpful
  • Mahmoud-AbdelKarim•600
    @Mahmoud-Abdelkarim777
    Posted 7 months ago

    I have looked at your code and I think your solution is great but if you want to center the card in the middle of the screen you have to give the container a height 100 vh .container { display: flex; flex-direction: column; justify-content: center; align-items: center; margin-bottom: 10px; height: 100vh; }

    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