Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

QR code component

Kalhara Sandaruwanโ€ข 190

@Impodays

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


My solution to QR-code-component challenge. Please give a review

Community feedback

Lucas ๐Ÿ‘พโ€ข 104,420

@correlucas

Posted

๐Ÿ‘พHello Kalhara, congratulations for your first solution! ๐Ÿ‘‹ Welcome to the Frontend Mentor Coding Community!

๐Ÿ‘ Great start and great first solution! Youโ€™ve done really good work here putting everything together, Iโ€™ve some suggestions you can consider applying to your code:

The approach you've used to center this card vertically is not the best way, because using margins you don't have much control over the component when it scales. My suggestions is that you do this alignment with flexbox using the body as a reference for the container.

The first thing you need to do is to remove the margins used to align it, then apply min-height: 100vh to the body to make the child (the card/container) align to its size that now will be displaying 100% of the viewport height and then give its alignment with display: flex and align-items: center / justify-items: center.

Here's your code fixed:

REMOVE THE MARGIN:

.card {
    /* margin: 20rem auto; */
    background: var(--clr--white);
    padding: 1.2rem;
    border-radius: var(--radius);
    max-width: 360px;
}

ADD MIN-HEIGHT AND FLEXBOX:

body {
    min-height: 100vh;
    font-family: var(--ff-primary);
    background: var(--clr--grey);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

โœŒ๏ธ I hope this helps you and happy coding!

Marked as helpful

1

Kalhara Sandaruwanโ€ข 190

@Impodays

Posted

@correlucas thank you so much. It really helps me

0
Niklausโ€ข 160

@NiklausRupail

Posted

create a div with class container or use body tag, but you need to center that div body { height: 100vh; } and then .card { display: flex; justify-content: center; align-items: center; }

Marked as helpful

1

Kalhara Sandaruwanโ€ข 190

@Impodays

Posted

@NiklausRupail thank you so very much.

0

Please log in to post a comment

Log in with GitHub
Discord logo

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