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

Centering all of it: transform: translate();

Maxβ€’ 40

@K4zuki-dev

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


At the start I hat problems of thinking of a way how to even start, then I just started and just tried things out, worked fine, hardest part was centering it so that it would be centered for all devices.

Community feedback

Travolgi πŸ•β€’ 31,420

@denielden

Posted

Hi Max, congratulations on completing the challenge, great job! 😁

Some little tips for optimizing your code:

  • add main tag and wrap the card for improve the Accessibility
  • use class to style the element and not a id because it must be unique into all the page
  • use p for the text of card instead of h2
  • add descriptive text in the alt attribute of the images
  • centering a div with absolute positioning is now deprecated, it uses modern css like flexbox or grid
  • use flexbox to the body to center the card. Read here -> best flex guide

Hope this help! Happy coding πŸ˜‰

Marked as helpful

0

Maxβ€’ 40

@K4zuki-dev

Posted

@denielden Thank's for the tips, I updated the code now and I fixed the things you told me to, the ID's are gone and replaced with classes, h2 is now a p, and especially the way I aligned it to the center of the site, Flex is waaay easier and it'll be helpful for sure in the future, thanks for your feedback!

1
Travolgi πŸ•β€’ 31,420

@denielden

Posted

@K4zuki-dev You are welcome and keep it up :)

0
Nelson Nzewiβ€’ 270

@nzewi

Posted

Congrats on completing this challenge Max

You have a great solution there. Nice trick you used to center the card

Here are my suggestions:

1.You can use flexbox as well to center the card

body {
            display: flex;
            justify-content: center;
            align-items: center;
      }

2.Use classes to style your elements to make your styles more reusable.

3.You can use max-width instead of width to make your card more responsive on smaller device widths

4.Ensure that all content on your page is contained within a landmark region, e.g Wrapping your box div in a <main>.

I hope this helps

Marked as helpful

0
Lucas πŸ‘Ύβ€’ 104,420

@correlucas

Posted

πŸ‘ΎHi @K4zuki-dev, congratulations on your first solution!πŸ‘‹ Welcome to the Frontend Mentor Coding Community!

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

Don’t use id to give the style of your elements, it's not a good idea because id is a too specific selector used for forms and Javascript code. Instead, use class for styling and let the id for much specific stuff. It's 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.

Use a CSS reset to avoid all the problems you can have with the default CSS setup, removing all margins, and making the images easier to work, see the article below where you can copy and paste this CSS code cheatsheet: https://piccalil.li/blog/a-modern-css-reset/

✌️ I hope this helps you and happy coding!

0

Maxβ€’ 40

@K4zuki-dev

Posted

@correlucas Hey, i've actually used the exact CSS reset and i've updated some stuff, the ID's are replaced with classes and I now use flex to align the box in the center, it works way better, thanks for your feedback!

1
Lucas πŸ‘Ύβ€’ 104,420

@correlucas

Posted

@K4zuki-dev this is really nice then say me if was useful for you and keep posting amazing content πŸ‘

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