Design comparison
Solution retrospective
- How do I get my Favicon image to show? It's linked in the HTML.
- The QR code picture is not showing either. The image file is on my computer and shows when I open the HTML in my browser but it doesn't show in my Github repo. I've added the image file to the Github folder but it still doesn't show.
Community feedback
- @Kamlesh0007Posted over 1 year ago
When referencing an image using the src attribute, it's important to provide a valid URL or relative path to the image file. In your case, you have provided an absolute file path (D:/faybas.github.io/image-qr-code.png), which will not work in the context of a web page.
To ensure that the image loads correctly, you should use a relative path or a valid URL. If the image is located in the same directory as your HTML file, you can use a relative path like this:
<img src="./image-qr-code.png" alt="QR Code"/> Make sure that the image file (image-qr-code.png) is located in the same directory as your HTML file.
and also add backgroundcolor to body tag
body { background: hsl(240, 100%, 98%); }
Marked as helpful1 - @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
BROKEN QR iMAGE📸:
- Quickly resolve it by changing this
src="D:/faybas.github.io/image-qr-code.png"
intosrc="./image-qr-code.png"
- Eg:
src="./image-qr-code.png"
CSS 🎨:
- Looks like the component has not been centered properly. So let me explain, How you can easily center the component without using
margin
orpadding
.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- To properly center the component in the page, you should use
Flexbox
orGrid
layout. You can read more about centering in CSS here 📚.
- For this demonstration we use css
Grid
to center the component.
body { min-height: 100vh; display: grid; place-items: center; }
- Now remove these styles, after removing you can able to see the changes
.center { margin-left: auto; margin-right: auto; margin-top: 200px; }
- Now your component has been properly centered
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0@faybasPosted over 1 year ago@0xAbdulKhalid Thanks a lot. Your response improved my work so much
0
Please log in to post a comment
Log in with GitHubJoin 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