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

J 330

@littledragonshrimp

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


  • How do you make the text an appropriate size at different window sizes?
  • How do you make the square centered horizontally?
  • How would you simplify the process of doing this?

Community feedback

@artuino0

Posted

Hi Jordan. You can center the div horizontally using Flex and setting the content with justify-content and align-items, for example:

//HTML
<div class="parent-div">
   <div class="child-div"> Hello World! </div>
</div>

//CSS

.parent-div{
  display: flex;
  justify-content: center;
  align-items: center;
}
1

J 330

@littledragonshrimp

Posted

@artuino0 Thanks Arturo, I tried this but whenever I 'display: flex;' all my code falls apart and they're not blocked over each other. I tried display: block; as seen in the code currently, and they're blocked over each other, just not centered horizontally

0
g0sie 10

@g0sie

Posted

To make different font-size for different window sizes you can use media queries. For example:

p {
    font-size: 12px;
}

@media (min-width: 600px) {
    p {
        font-size: 14px;
    }
}
1
Lucas 👾 104,440

@correlucas

Posted

👾Hi Jordan, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!

Great solution and great start! By what I saw you’re on the right track. I’ve few suggestions to you that you can consider to add to your code:

1.Don’t use id to give the style of your elements, its not a good idea because id its a too much specific selector used for forms and Javascript code. Instead, use class for styling and let the id for much specific stuff. Its also not advisable to use IDs as CSS selectors because if another element in the page uses the same/similar style, you would have to write the same CSS again. Even if you don't have more than one element with that style right now, it might come later.

2.Use <main> instead of <div> to wrap the card container. This way you show that this is the main block of content and also replace the div with a semantic tag.

3.The html structure is fine and works, but you can reduce at least 20% of your code cleaning the unnecessary elements, you start cleaning it by removing some unnecessary <div>. For this solution you wrap everything inside a single block of content using <div> or <main> (better option for accessibility) and put inside the whole content <img> / <h1> and <p>.

<body>
<main>
<img src="./images/image-qr-code.png" alt="Qr Code Image" >
 <h1>Improve your front-end skills by building projects</h1>
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</main>
</body>

✌️ I hope this helps you and happy coding!

1

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