Looking at the code, you appear to be suffering from whats known as "divitis". I have some suggested improvements for you
- Change container to a
main
element. Then remove all divs, placing classes directly on the elements you want to style instead - Update the alt text on the image so it's more meaningful. QR code to... Where? (Add basic url)
- To center your card on the page use flex or grid properties on the body along with min-height 100vh. Remove the large margin. Add a small amount of padding on body or margin on the card just so it can't hit screen edges on small screens.
- The card should not have a width. Change that to max-width so it can go narrower if/when it needs to. It's even better if that value is in rem instead of px
- The card should have padding. Padding is for internal spacing - it's that space between the card edge and all the contents inside.
- The img should be display block and max-width 100%. It should not have margin top.
- Really important - font size must never ever be in px. Use rem.
- The card children will need vertical margins to create space between them (margin is for external spacing). They shouldn't need padding..
@raghuaanand
Posted
@grace-snow I am now on the way to cure myself from 'divits'. Is this what you suggested?
<body> <main> <img src="./images/image-qr-code.png" class="header" width="260px" alt="QR Code to Frotnend Mentor"> <h3 class="para-heading">Improve your front-end skills by building projects</h3> <p class="paragraph"> Scan the QR code to visit Frontend Mentor and take your coding skills to the next level </p> </main> </body>I am working on the other things also. Thanks once again!