@correlucas
Posted
๐พHi Cintia, congratulations on your solution!๐ Welcome to the Frontend Mentor Coding Community!
Great solution and a great start! From what I saw youโre on the right track. Iโve few suggestions for you that you can consider adding to your code:
๐พ 1.The main heading has the tag <h3>
, in this case, you should replace it with <h1>
since this heading is the main title on this page. Remember that every page should have one <h1>
to declare which is the most important title and that you should follow the hierarchy using the heading sequence (h1, h2, h3, h4, h5)
and never jump a level.
๐พ 2.Your HTML code is not optimized yet, since it's too long and has some unnecessary elements. To make it clean you start by removing some unnecessary <div>
. For this solution you wrap everything inside a single block of content using <div>
or <main>
(better option for accessibility) and put inside the whole content <img>
/ <h1>
and <p>
.
<body>
<main>
<img src="./images/image-qr-code.png" alt="QR Code Frontend Mentor" >
<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>
</main>
</body>
๐พ 3.To reduce the CSS you can use the direct selector for each element instead of using class
this way you have a code even cleaner, for example, you can select everything using the direct selector for (img, h1, and p, main).
๐พ 4.Note that there's no need to use height
here, because since you set a height
for an element, this means that this element will grow until a certain point and after that the inner content (as texts or images) will start to pop out the element due its fixed height, so isn't necessary to set the height
the container height comes from the elements, its paddings and height.
5.The image is not responsive yet, a quick way to make any image responsive and respecting the container size is to add display: block
and max-width: 100%
to the <img>
selector.
img {
display: block;
max-width: 100%;
}
๐พ 6.Fix the component responsiveness, its not working yet and this is due the fixed width
you've applied to the container. The difference between width
and max-width
is that the first(width) is fixed and the second(max-width) is flexible
and make the element shrink when the screen starts to scale down. So if you want a responsive block element, never use width
choose or min-width
or max-width
.
Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/qr-code-component-vanilla-cs-js-darklight-mode-nS2aOYYsJR
โ๏ธ I hope this helps you and happy coding!
Marked as helpful
@ciisiq
Posted
@correlucas wow thank you a lot, when I sent the solution I saw the website complain about the H1 I didn't understand but now makes a lot of sense!! Thank you so much for your time I will improve my code =) I will check your solution!!
@correlucas
Posted
@ciisiq You're welcome Cintia! I'm looking forward to see your next challenges here. Keep it up =)