Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 11 months ago

basic card using html, css

khushi-vish•10
@khushi-vish
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)
Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

  • Peter•20
    @skipperr254
    Posted 11 months ago

    Hi there Khushi, good job on the project.

    • I noticed you used the with property in the body element and set it to 100%. In my experience and advice from experts, it's usually not necessary and everything works if it's omitted completely. It also adds the scroll effect even on a page that it is not necessary at all.

    • Also, didn't the justify-content: center; work or why did you comment it out? I think it would have centered the card element. If you were being adventurous then its okay. Just wanted to know.

    • I missed the background color/colour of the body too, lol! Not sure where I went wrong but will look at it later.

    • Also, when I submitted my solution, I was pushed to correct on accessibility by using HTML5 landmarks like header, main, footer, etc.

  • P
    Øystein Håberg•13,260
    @Islandstone89
    Posted 11 months ago

    Hi! Good job.

    Here are some things that need to be improved. Please don't be disheartened - we all start somewhere :)

    HTML:

    • Every webpage needs a <main> that wraps all of the content, except for <header> and footer>. This is vital for accessibility, as it helps screen readers identify a page's "main" section. Wrap the card in a <main>.

    • The alt text must also say where it leads(the frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website."

    • Headings should always be in order, so you never start with a <h3>.As the card heading would likely not be the main heading on a page, I would change it to a <h2>.

    • .attribution should be a <footer>, and you should use <p> for the text inside.

    CSS:

    • It is best practice to write CSS in a separate file, often called style.css. Create one in the same folder as the index.html, and link to it in the <head>: <link rel="stylesheet" href="style.css">.

    • Including a CSS Reset at the top of the stylesheet is good practice.

    • Use the style guide to find the correct background-color.

    • I like to add 1rem of padding on the body, to ensure the card doesn't touch the edges on small screens.

    • You don't need width: 100% on the body - it is a block element, meaning it takes up the full width by default.

    • On the body, change height to min-height: 100svh - this way, the content will not get cut off if it grows beneath the viewport.

    • On body, uncomment justify-content: center.

    • On body, add gap: 2rem, to create some space between the main and the footer.

    • Remove the margin on the card.

    • Remove all widths and heights. Fixed sizes set in px are not recommended.

    • Add a max-width of around 20rem on the card, to prevent it from getting too wide on larger screens.

    • font-size must never be in px. This is a big accessibility issue, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead.

    • Since all of the text should be centered, you only need to set text-align: center on the body, and remove it elsewhere. The children will inherit the value.

    • On the image, add display: block and max-width: 100% - the max-width prevents it from overflowing its container.

    • I would make the corners of the image the same as the card:border-radius: 20px.

    • Remove position: fixed on the footer.

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