Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

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

progressive-enhancement, styled-components
SHIVAM KUMAR SINGH•10
@codershivamkumarsingh
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

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?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Assurance Chioma Ikogwe•410
    @Aik-202
    Posted almost 3 years ago

    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•16,830
    @PhoenixDev22
    Posted almost 3 years ago

    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

  • Lucas 👾•104,160
    @correlucas
    Posted almost 3 years ago

    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 the body 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 and display: flex e flex-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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub