Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

I used html structure and css , and use of divs and classes selectors

foundation
KabongeHajarah•40
@KabongeHajarah
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


1.Are there any best practices in terms of CSS styling or HTML structure that I could improve upon? 2.Is the image optimization done effectively for fast loading times and optimal performance? 3.Are there any areas of my code that could be refactored or optimized for better efficiency?

Do you have any suggestions or feedback on the choice of fonts, colors, and overall design aesthetics of the website? Are there any other best practices or recommendations that I should be aware of to improve the quality and performance of my front-end project?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Ecem Gokdogan•9,380
    @ecemgo
    Posted about 2 years ago

    Some recommendations regarding your code that could be of interest to you.

    • I think Flexbox is better than Grid in centering both horizontally and vertically. I recommend this method, it's up to you whether to apply it or not :)
    • If you want to make the card centered, you'd better add flexbox and min-height: 100vh to the body
    • For the color of the screen, you can use the recommended color in the body
    body {
      /* background-color: rgba(214, 216, 218, 0.445); */
      /* text-size-adjust: 100%; */
      /* display: grid; */
      /* place-items: center; */
      /* height: 100vh; */
      font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
      /* text-size-adjust: none; */
      background-color: hsl(212, 45%, 89%);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
    }
    
    • In addition to that above, in order to make the card responsive and the image positioned completely on the card, you'd better add width: 100% and display: block for the img in this way:
    img {
      /* width: 240px; */
      width: 100%;
      display: block;
      border-radius: 10px;
    }
    
    • You don't need to use .code-div and you can remove it
    /* 
    .code-div {
      margin-bottom: 10px;
      margin-top: 10px;
    } 
    */
    

    Hope I am helpful. :)

    Marked as helpful
  • Muhammad Faizan•320
    @Faizan98x
    Posted about 2 years ago

    Use HTML semantic tags as they will help in better SEO. Replace the <div> with <main> or <section>. Follow this link to get more about semantic tags : https://www.w3schools.com/html/html5_semantic_elements.asp

    And also use -moz-text-size-adjust: none; -webkit-text-size-adjust: none; for cross-browser compatibility

    Marked as helpful
  • EmmanuelUrias•130
    @EmmanuelUrias
    Posted about 2 years ago

    It looks great, but some things I'd like to point out is that putting some more padding on the bottom would be more aesthetically pleasing, and making the card wider would have made the text fit better within it. Looked at your code base and I would recommend having a consistent format when it comes to tabbing and line spaces to make it more readable and overall look cleaner. Another important thing is a really consistent naming style, you went from camel case with mainDiv to kebab case for code-div. Other than that great job!

    Marked as helpful

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