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

devusexu 130

@devusexu

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


  1. How can I improve the html structure (semantics) ?
  2. How to center the main element vertically besides using the fixed value (i.e. I use margin: 12em auto)? Maybe with percentage/vh or using position as I think hard-coded value is not good
  3. Should I use flexbox in this example?
  4. Should I implement BEM/OOCSS or Sass from now on for better organization?

Thanks for reading. Any advice would be greatly appreciated!

Community feedback

BRIVAL-M 60

@BRIVAL-M

Posted

Hi :) For semantics, you can use the HTML tag <figure> to code your card.

More about this tag

And here is an image explaining the BEM, but you already know :) BEM tips img

Marked as helpful

1

devusexu 130

@devusexu

Posted

@BRIVAL-M

Thanks for sharing!

I forgot this tag and I didn't see this picture before. Seems the naming can let me write less combinators and understand the component it indicate more easily.

Good to know these concepts, thank you.

0

@LuisJimenez19

Posted

Hi, congratulations on finishing the challenge.

You are correct there is a better way to center it. A tip is that whenever possible it is better to manipulate the content from its container. You can do this:

body {
    flex-direction: column;
    min-height: 100vh;
    display: flex;
    background-color: var(--bg-color);
    justify-content: center;
    align-items: center;
}

This will center everything perfectly. I see that you use <main> to make the card, which is fine but would be better:

<main>
<div class="card" >
    <img src="images/image-qr-code.png" alt="qr-code">
    <h2>Improve your front-end skills by building projects</h3>
    <p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</div>
  </main>

and in this .card give it the styles of the card, and if what you want is to leave the footer below you can apply to the main a ``flex-grow:1;

I hope my contribution is helpful.

Marked as helpful

1

devusexu 130

@devusexu

Posted

@LuisJimenez19

Thanks for your generous sharing!

I try flexbox in my second challenge and I feel much better now.

I originally want to reduce the unnecessary tags as long as I can, but now I see <div class="card"> is better for styling to reduce confusion, no matter during development or reading the code afterwards.

It help a lot, thank you.

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