html , css , stylesheets and css magin , color ,etc.

Solution retrospective
If i make the bottom-margin of div class specific my other anrgins get changed how can i control it? there is also written width 1440 px but it gets way bigger , what to do?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Aik-202
Hey Shivam, This is a Nice attempt. To answer your questions: 1.) It's not good to use margins to adjust the contents of your page. There are other ways you can do that. You can use CSS Flex, Grid. My personal recommendation is CSS Flex. So start by removing the margins from your div. then do this: div { display: flex justify-content: center; align-items: center; } display: flex allows you use CSS flex properties. Then justify-content and align-items set to center will completely center ya div container... Also set the width of your image to 100% and also use the max-width:100% property so you image takes the width of your container. To learn more about CSS flex, visit: https://www.w3schools.com/cssref/css3_pr_flex.asp
2.) The reason why everything is bigger on mobile is because your page contents are too big .. so the mobile phone is adjusting to the size of the page contents. I'll also advice you use Media queries . To learn about it visit : https://www.w3schools.com/css/css_rwd_mediaqueries.asp
I hope you find this helpful, keep improving on your solution!
- @PhoenixDev22
Congratulation on completing this frontend mentor challenge. Your solution looks great. I have some suggestions regarding your solution:
- You should use
<main>
for the card. HTML5 landmark elements are used to improve navigation experience on your site for users of assistive technology.
- Page should contain
<h1>
. In this challenge , as it’s supposed to be a part of a whole page, you may use<h1>
visually hidden with class=”sr-only”. You can find it here
- In my opinion, the image is an important content. The alternate text is needed on this image. The alternate text should indicate where the Qr code navigate the user : like
QR code to frontend mentor
not describes the image.
- In order to center the card on the middle of the page , you can use the flex or grid properties and
min-height: 100vh
to the ``<body>`. Add a little padding to the body that way it stops the component from hitting the edges of the browser and then you can remove the large margins.
- Select what you want explicitly, rather than relying on circumstance or coincidence.
- Write selectors for reusability, so that you can work more efficiently and reduce waste and repetition.
Hopefully this feedback helps
- You should use
- @correlucas
Hello Shivam, congratulations for your solution.
To do the alignment and manage the content you don't really need any margin, you can use padding for the inner spacing inside the card and flexbox for the vertical alignment. To make this alignment, first of all put
min-height: 100vh
to thebody
to make the body display 100% of the screensizeheight (this makes the container align to the height size thats now 100% of the screen height) size anddisplay: flex
eflex-direction: column
to align the child element (the container) vertically using the body as reference.Try to apply this changes and remove the margins to align the card.
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