@bccpadge
Posted
Hello @bdal90. Congratulations on completing this challenge!!!π
I have a few tips you might be interested in to improve your solution.
HTML π:
- Every website should have at least one landmark like a
main
HEADING TAGS
- Heading tags must be used in chronological order. Its not best practice to skip heading tags due to SEO and accessibility reasons.
More infoπ:
Example:
<body>
<main class="container">
<img>
<div class="content__group">
<h1>Improve your front-end skills by building projects</h1>
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</div>
</main>
<footer>
/* attribution info goes here*/
</footer>
</body>
CSS π¨:
- Font size shouldn't be in pixels because they are absolute unit and doesn't scale when users want to change their font size in their web browser setting.
- To write better CSS you can implement the DRY principle (Don't Repeat Yourself)
- I would look at using CSS shorthand properties when using
padding
andmargin
You can use CSS Grid on the body
and saves you few lines in CSS
-
Add
font-family
on thebody
instead of thecontainer
-
All the commented code below is unnecessary and add
max-width
to make the component responsive without media queries and addingpadding
for spacing.
.container {
/* font-family: Outfit, sans-serif; */
/* font-size: 15px; */
background-color: hsl(0, 0%, 100%);
/* display: flex; */
/* flex-direction: column; */
/* align-items: center; */
/* justify-content: space-between; */
/* height: 430px; */
/* width: 270px; */
border-radius: 20px;
box-shadow: 0 0 10px 10px hsl(210, 30%, 83%);
padding-top: 10px;
padding-bottom: 30px;
max-width: 380px;
padding: 1rem;
}
/*Max-width: 100%; makes image responsive and display: block removes white space*/
.container__qr-code{
max-width: 100%;
display: block;
}
Example:
- Wrap your
h1
andp
using adiv
and put a class on thatdiv
and applytext-align:center;
More infoπ:
Here is my solution to this challenge: QR Code component
Hope you find this useful and don't hesitate to reach out to me if you have any questions
Marked as helpful
@bdal90
Posted
Thank you very much for your insightful comment @bccpadge! I will keep these in mind.