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 Component using basic CSS

@Smith11b

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


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

I tried not to use extra divs where I didn't need them.

What challenges did you encounter, and how did you overcome them?

I may be using my sub selector incorrectly (container p instead of container > p)

I also don't like the use of VH for the main, but couldn't think of a better way to do that.

What specific areas of your project would you like help with?

Was I using the sub selectors correctly? (container p vs container > p)

Is there a better way to center the card. (The age old question)

Community feedback

@KapteynUniverse

Posted

Hey Mark, nice job.

.container p {...} means p tag inside the container, doesn't matter how nested the p is. For example .container p {...} will style this:

<div class="container"><div><div>
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</div></div></div>

but .container > p {...} will not. .container > p {...} only works for this:

<div class="container">
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</div>

p has to direct children of the .container

I prefer to use neither of them. But i will choose .container > p {...} if i have to because .container p {...} might cause some styling issues on bigger projects if not used carefully.

You can also make it longer like .container > div > div > p {...}

Also i would move the flex to the body (for footer and header)

body {
    background-color: #D5E1EF;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

For centering you can also use grid, it is just 1 less line of code. Flex or grid, whatever you prefer

Marked as helpful

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