Skip to content
Submitted 11 months ago

Viewport centeted QR-code component

accessibility
LVL 1
@egorpya
A solution to the QR code component challenge

Solution retrospective


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

First of all, I am really proud of myself for taking the first step in this journey. I enjoy this feeling of tinkering with code and I do not understand how I didn't returned earlier!

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

As always, centering a div is a problem. The Problem. My first idea was using Flexbox, but then I was stuck with responsitivity issues. So, I found this solution:

.please_for_gods_sake_just_center_already {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-right: -50%;
  transform: translate(-50%, -50%);
}

There were problems with the QR code image. Still learning how to deal with \<img> scaling. Right now I did it like this:

```css
img {
  width: auto;
  height: auto;
  max-width: 300px;
  max-height: 300px;
}

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Egor Pyankov’s solution.

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