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

Lara Mesa 160

@Lara-art

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’m really proud of this CSS code because I made it mobile responsive without using any @media queries.

h1 {
    font-size: clamp(2.2rem, 1.986rem + 0.571vw, 2.5rem);
}

.container {
    max-width: 1440px;
    margin: auto;
    padding: 2rem;
    display: grid;
}

Using place-content: center, I was able to align and justify it both vertically and horizontally.

.container {
    display: grid;
    place-content: center;
}

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

The biggest challenge for me was not using @media, instead relying on relative units, and making sure everything was centered on the screen.

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

I’d like to know if this is actually the right way to do it to avoid using @media. Also, how can I improve my CSS writing skills?

Community feedback

P
Koda👹 3,810

@kodan96

Posted

hi there! ✌️

  • all content within the body tag should be wrapped inside milestones (header, main and footer HTML tags)

  • don't use the 62.5% font size hack, it causes accessibility issues.

  • use rem or other relative units instead of pixels for font sizes or pretty much anything else.

  • don't apply width to your elements explicitly. if you want to determine the width of your element use min-width or max-width. you can even combine them with width:

.element {
  width: 90%;
  max-width: 66rem;
}

with this .element will take up 90% of the parent container's width, but when it reaches the 66rem in width it will stop expanding any further

Hope this was helpful 🙏

Good luck and happy coding! 🙌

Marked as helpful

1
ijohnst 230

@ijohnst

Posted

First of all great work, you definitely got it working. To add on to the other comment you really don't need grid or flex on your container and you don't need the unnecessary divs you have throughout the HTML. All of these elements are going to be block elements so they will stack by default (you can see it if you write all the HTML and don't add CSS yet).

Wrap your <img><h1><p> in an <article> and then let either some padding or margin handle the spacing.

You can however use the grid, place contents trick on either your <body> or <main> (if you choose to wrap it in that) to center the content. But inside the card you should avoid the divs and flex for now. You'll have plenty of opportunities to use them in the later challenges.

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