Skip to content

Henrydevlab/qr-code-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - QR code component solution

This is a solution to the QR code component challenge on Frontend Mentor.

Table of contents

Overview

Screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • Relative units (rem, %, vh)

What I learned

This project was a great exercise in applying modern CSS layout techniques for perfect centering and ensuring responsiveness, even on a small component.

1. Perfect Centering with Flexbox

I successfully used Flexbox on the <body> element to center the component vertically and horizontally, ensuring it stays centered regardless of the viewport size.

body {
  /* ... other styles */
  display: flex;
  flex-direction: column;
  justify-content: center; /* Centers vertically */
  align-items: center;    /* Centers horizontally */
  min-height: 100vh;      /* Ensures body takes up full viewport height */
  padding: 1.5rem;        /* Safety padding for small viewports */
}

2. Using CSS Custom Properties

Defining all design variables in a :root block made the colors and typography easily manageable and consistent across the stylesheet.

:root {
  /* Colors */
  --color-white: hsl(0, 0%, 100%);
  --color-slate-900: hsl(218, 44%, 22%);

  /* Typography */
  --font-family-outfit: 'Outfit', sans-serif;
}

Continued development

I want to continue focusing on:

  • Accessibility (A11y): Ensuring all projects meet high WCAG standards, particularly focusing on keyboard navigation and ARIA attributes in more complex components.

  • CSS Logical Properties: Exploring and adopting CSS logical properties (like padding-inline, margin-block) to future-proof my projects for internationalization.

Useful resources

Author

About

QR Code Component: A pixel-perfect, mobile-first design built with semantic HTML and Flexbox/Grid for a centered card layout.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors