Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

qr-code-component using css and html, used positions and images.

floppitommiiiiiβ€’ 10

@floppitommiiiii

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


i had trouble with the length and width of the project, finding the correct length and width. I could only make mine for full screen 2560 Γ— 1600 resolution.

Community feedback

@MelvinAguilar

Posted

Hello there πŸ‘‹. Good job on completing the challenge !

I have some suggestions about your code that might interest you.

Styles:

  • Remove the max-width and height of the * selector, let it occupy 100% of the screen width. When you set a fixed width, it will only work well when the viewport has the same width,
  • There are some lines of text that are unnecessary, delete or comment them out: line github
  • Centering an element with position: absolute would make your element behave strangely on some screen sizes, "there's a chance the content will grow to overflow the parent". You can use Flexbox or Grid to center your element. You can read more about centering in CSS here πŸ“˜.

    Before trying to make your solution look like the picture, you should try to fix your solution by removing all absolute positions.

    .design {
        background-color: hsl(212, 45%, 89%);
        min-height: 100vh;
        display: grid;
        place-content: center;
    
        /* width: 1200px; */
        /* height: 700px; */
        /* position: relative; */
        /* left: 120px; */
        /* right: 120px; */
        /* top: 64px; */
        /* bottom: 64px; */
    }
    
    .container {
        /* position: absolute; */
        /* width: 300px; */
        max-width: 300px;
        /* height: 420px; */
        background-color: hsl(0, 0%, 100%);
        /* left: 450px; */
        /* right: 450px; */
        /* top: 140px; */
        /* bottom: 140px; */
        border-radius: 25px;
        /* padding-top: 15px; */
        /* padding-bottom: 15px; */
        /* padding-left: 15px; */
        /* padding-right: 15px; */
        padding: 15px; /* The padding property is a shorthand property for all the paddings*/
    }
    
    .container img {
        /* position: absolute; */
        /* width: 250px; */
        /* height: 250px; */
        /* left: 40px; */
        /* right: 40px; */
        width: 100%;
        border-radius: 15px;
    }
    
    .container h2 {
        /* position: absolute; */
        color: hsl(218, 44%, 22%);
        /* top: 250px; */
        font-size: 17px;
        margin: 15px;
    }
    
    .container p {
        /* position: absolute; */
        color: hsl(220, 15%, 55%);
        font-size: 15px;
        /* top: 350px; */
        margin: 15px;
    }
    

HTML πŸ“„:

  • 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.

Alt text πŸ“·:

  • The alt attribute should not contain underscores or hyphens, it must be human readable and understandable.
  • The alt attribute should not contain the words "image", "photo", or "picture", because the image tag already conveys that information.
  • The alt attribute should explain the purpose of the image. Uppon scanning the QR code, the user will be redirected to the frontendmentor.io website, so a better alt attribute would be QR code to frontendmentor.io

    If you want to learn more about the alt attribute, you can read this article. πŸ“˜.

CSS 🎨:

  • Instead of using pixels in font-size, use relative units like em or rem. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here πŸ“˜.

I hope you find it useful! πŸ˜„

Happy coding!

Marked as helpful

0

floppitommiiiiiβ€’ 10

@floppitommiiiii

Posted

Thank you so much, I really appreciate your comment.

1
Ahmed Mahrousβ€’ 980

@AhmedMahrouss

Posted

good jop my bro Congrats on completing your challenge!🎊🍻If you have any questions or need further clarification, feel free to reach out to me. Happy Coding! πŸŽ†πŸŽŠ

0

Please log in to post a comment

Log in with GitHub
Discord logo

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