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

Responsive landing page using CSS and HTML

Carolyn•10
@carolyngorski
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


This project made me review CSS and HTML, and I'm honestly a bit unsure about the text-align property, I understand its function but I feel like I need more experience with working it out.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Melvin Aguilar 🧑🏻‍💻•61,020
    @MelvinAguilar
    Posted over 2 years ago

    Hi there 👋. Good job on completing the challenge ! I have some feedback for you if you want to improve your code.

    HTML Structure:

    I noticed that your html file does not have the basic structure of a web page (html, head, body) and it is missing the <!DOCTYPE html> declaration. You can read more about this here.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Title</title>
    </head>
    <body>
       <! -- Main content of website -->
    </body>
    </html>
    

    You can read more about this here

    HTML:

    • The lang attribute is used to declare the language of the webpage. Create an <html> tag and add the lang attribute to the <html> tag with the value en.
    • The viewport meta tag is missing. the viewport meta tag is used to control the layout of the page on mobile devices. Add the viewport meta tag to the <head> tag: <meta name="viewport" content="width=device-width, initial-scale=1.0">
    • Use the <main> tag to wrap all the main content of the page instead of the <div> tag. With this semantic element you can improve the accessibility of your page.
    • You must use a level-one heading (h1) even though this is not a full-page challenge. You can create an '<h1>' element within your 'main' element that will be hidden visually but visible and readable by screen readers. The class "sr-only" hides content visually and here are the styles to copy. e.g.: <h1 class="sr-only">QR Card Component</h1>

    I hope you find it useful! 😄 Above all, the solution you submitted is great!

    Happy coding! 🎄

    Marked as helpful
  • Abdul Khaliq 🚀•72,380
    @0xabdulkhaliq
    Posted over 2 years ago

    Hi there 👋:

    • We gladly welcome you to the Front end mentor community
    • You just completed a solution as per the design Congratulations..🙌
    • But, There's an report in accessibility which causes accessibility error

    RESOLVING THE ERROR

    • <html> must have language attribute which improves accessibility so change it to <html lang="en">
    • And then provide alt text to img element by doing this
    • <img src="image-qr-code.png" alt="qr-code">
    • The div with class .parent is meant to be a main element
    • Because using semantical elements to structure the HTML improves the accessibility for screen readers
    • So change the div into main element

    MESSAGE:

    • If my answer helps you then providing an upvote will be very helpfull
    • And don't forget to mark this comment as helpfull. If it helps to resolve your issues
    • I hope you learned a lot of stuffs during this project, Congrats Carolyn

    GREETINGS:

    • Happy coding..🙌
    • Peace be upon you with god's mercy & blessings..✨
    Marked as helpful
  • Yefry Sanchez•330
    @y25sanchez
    Posted over 2 years ago

    Great job Carolyn!

    I have some recommendations to improve your code...

    The best way to center the QR code component is by applying some styles in the body. This will work only if you remove the positioning properties that you applied in the child and parent elements

    body{
        height: 100vh;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: 'Outfit';
        background-color: hsl(212,45%,89%);
    }
    

    The font family ''Outfit'' is the main font you can add it to the body so like that you don't have to repeat code.

    Also you are missing some fundamental things in the structure of your html file.

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Qr codep roject</title>
      <link rel="stylesheet" type="text/css" href="style.css" />
      </head>
      <body>
        <div class="parent">
          <div class="child">
            <img src="image-qr-code.png" />
            <h2>Improve your front-end skills by building projects</h2>
            <p>
              Scan the QR code to visit Frontend Mentor and take your coding skills
              to the next level
            </p>
          </div>
        </div>
      </body>
    </html>
    

    Hope you a nice day! Keep up the good work!

    Marked as helpful
  • Hassia Issah•50,410
    @Hassiai
    Posted over 2 years ago

    Replace <div class="parent"> with the main tag to fix the accessibility issues. for more on semantic html visit https://web.dev/learn/html/semantic-html/

    To center .child on the page, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to .parent. Instead of giving .child position: relative and its properties.

    Give .parent a height of 100%, width of 100% , padding: 0; and margin: 0; there is no need for position: relative in .parent

    Use rem or em as unit for the padding, margin, width and preferably rem for the font-size for more on this watch this https://youtu.be/N5wpD9Ov_To

    Hope am helpful HAPPY CODING

    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

Oops! 😬

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

Log in with GitHub