QR Code component using HTML and CSS

Please log in to post a comment
Log in with GitHubCommunity feedback
- P@19Rohan97
Awesome work! You've replicated the design exceptionally well — your attention to detail and execution really stand out. It's evident that you understand the layout structure and styling principles well. Keep up the great work!
✅ One Suggestion – Simplify with Universal Selector
*
In your CSS, I noticed you've explicitly listed out every single element (like
html
,body
,div
,h1
,p
, etc.) for resetting default styles. While this is thorough and ensures cross-browser consistency (especially for older projects), it’s also quite verbose and can be simplified in modern workflows.
🔁 Recommendation: Use the Universal Selector
Instead of:
html, body, div, span, applet, object, iframe, ... (and many more)
You can use:
* { margin: 0; padding: 0; box-sizing: border-box; }
This does the same job more efficiently by:
- Removing default
margin
andpadding
from all elements - Setting a consistent
box-sizing
model (border-box
) which is easier to manage when working with padding and widths
🕹️ Optional for Older Browser Compatibility
If you're specifically targeting older browsers or legacy layouts, it’s still valid to use a detailed reset like the one you provided. It follows the Eric Meyer reset pattern, which was popular before modern CSS tools became mainstream.
However, for most current web development scenarios, especially in a learning or modern portfolio project, the universal
*
selector or a CSS Reset/Normalize file is enough.
🧠 Pro Tip
For even better practice, combine the universal selector with
::before
and::after
to cover pseudo-elements:*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
This ensures full consistency in how box dimensions are calculated — even for decorative elements like icons or overlays.
- Removing default
- @Lalalaloo
This looks exactly like the designn
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