Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 6 months ago

Responsive QR component using HTML and CSS

ABHISHEK PM•70
@abhishekpm15
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


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

I'm proud that I have started my challenege path and would love to learn most out of this. Next time I would use different approach to solve the same challenge. I have used plain CSS in this challenge. Next time I would prefer using Tailwind CSS.

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

There were no challenges I faced, since this was a beginner level challenge.

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

I would like to know if my approach and design principles were good enough to be applied in real projects.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Darkstar•1,440
    @DarkstarXDD
    Posted 6 months ago

    Couple of suggestions.

    • Use meaningful elements. Currently everything is just divs. divs are good for structuring things and help with layouts, but div itself is not a semantic element, so it doesn't really have any meaning.
    • "Improve your front-end..." should be the heading of this card. It can be a h1. Usually this entire card will be placed in a page along with other elements, so in that case this won't likely be the h1. The h1 would be some other element that explains the content of the entire page. But in the given scenario you can make it a h1.
    • "Scan the QR code..." should be a <p>.
    • Use rem unit for font-sizes. px units won't scale with the browsers font settings, so if the user who visits your webpage have changed their browser default font sizes, they won't be reflected on your page. rem on the other hand respects the browsers font settings and change accordingly. So always use rem for font sizes.
    • The card should not have a fixed height. It will cause overflowing if the content inside the card changes. You don't have to specify the height of text containers. The browser will automatically calculate it for you based on the content inside the card, and other values like font sizes, paddings etc.
    • Same way the card should not have a fixed width either. When a fixed width is used the card can't shrink past that value, even if the screen size is small and the card doesn't have any space to fit in. That again will cause overflow issues and break your site. Instead use a max-width on the card. So you can control how large the card is allowed to be, but at the same time the card has the freedom to shrink automatically when there is no room to fit in smaller screens.
    • Don't mix ids and classes when it comes to styling. Always use classes for styling. Mixing the two will make you run into specificity issues. You can use ids when linking two elements together. For example linking an input element with the label element, or when using aria-describedby.
    • You should use landmark elements in your page. All the content in your page should be wrapped in a <main>, except the content in <header> and <footer>. So the <div> that you have given the id="card" should actually be a <main>. The attribution should ideally go inside the <footer> and should be outside of the <main>.
    • The attribution should be at the bottom of the page, it's bit weird seeing it at the very top like that.
    • There's no reason to use position: absolute on the card. Also i don't see a reason for the .card-body div. You can directly use the .card div. Try to keep the HTML simple.
    • I would give the height: 100vh to the body instead of giving it to that div. And make sure you use min-height and not height. Never limit the height of the body or any element that contains text.
    Marked as helpful

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub