This is a solution to the QR code component challenge on Frontend Mentor.
Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- Your challenge is to build out this QR code component and
- Get it looking as close to the design as possible.
Desktop View | Mobile View |
---|---|
- Live Site URL: Website Link - Click Me
- Solution URL: FrontEndMentor Link - Click Me
- Plain: HTML, CSS
- Mobile-first workflow (Using Media Queries)
Recap over some of the major learnings while working through this project:
- Basic review of HTML & CSS
- CSS Flex Layout
This code snippets/function, if what I'm proud to accomplished:
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
Here are a few possible areas that could be added or improved in the HTML and CSS code you provided:
- Accessibility: - It could be more accessible to users with disabilities by:
- Include appropriate ARIA attributes, alt text, and semantic HTML tags.
- Also, providing a larger font size, better color contrast, and using aria-label, aria-roles attributes for the interactive elements.
- Responsiveness: - Using responsive design techniques and media queries for different screen sizes and devices.
- Github - @Iron-Mark
- Frontend Mentor - @Iron-Mark
- I would like to acknowledge the hard work and dedication that I went into creating this website.
- (I'm still recovering from fever doing this lol)
- I am grateful for my friends and to those who motivate me push through and not settle in relaxation.
- I hope that this website serves its intended purpose. Thank you.
-
Melvin Aguilar 🧑🏻💻 • 41,690 (@MelvinAguilar)
-
Alt text 📷:
- The
alt
attribute should not contain underscores or hyphens, it must be human readable and understandable. - The
alt
attribute should not contain the words "image", "photo", or "picture", because the image tag already conveys that information. - The
alt
attribute should explain the purpose of the image.- Upon scanning the QR code, the user will be redirected to the frontendmentor.io website,
- So a better alt attribute would be:
alt="QR code to frontendmentor.io"
- If you want to learn more about the alt attribute, you can read this article 📘.
- The
-
CSS 🎨:
-
Setting the width of the component with a percentage or a viewport unit will behave strangely on mobile devices or large screens.
-
You should use a
max-width: 320px
or20rem
to make sure that the component will have a maximum width of 320px on any device. -
Also remove the width property with a percentage value.
-
A tip, instead of using
flexbox
and havingwidth: 87%
to center the image you could use padding on the component,- This way you would create the space between the image and the component border and not repeat so much code.
-
To give you an idea, the challenge does not require any media query,
- It can be made responsive for all devices just by using the necessary styles.
-
main > section { /* padding: 1rem 0rem; */ background-color: var(--white); /* width: 85vw; */ padding: 1rem; max-width: 318px; text-align: center; } div img { width: 100%; /* max-width: 87.5%; */ }
-
- Implement changes from community feedback
- Build with Svelte
- I would be happy to recieve comments, criticism, and such that could improve the website:
- Better way of doing this website
- Cleaner Code
- Better Practice
v1: Last Update: Feb 12, 2023 v2: On Progress...