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

HTML5 + CSS3 RESPONSIVE

accessibility
Túlio•30
@tuliovini13
A solution to the Results summary component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Yo guys, Thats my project that I spend 5 hours of my day hahaha I've too dificult to make the widths, I wanna help about this. I dont know how can I change widths EASIly, like change the left and right card's widths.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Yari Morcus•500
    @YariMorcus
    Posted over 2 years ago

    Hi Túlio,

    First of all, I think you did a great job on the challenge. The component is responsive and almost looks like the design (you forgot to add a white background to the result2 section).

    The only thing I noticed beside the above is that your favicon is not working (due to an incorrect path, you can see this in the JS console).

    To give you an answer to your question

    You can change widths more easily by not only using percentages (which you have done already), but also by using CSS Grid Layout.

    Alternative method with Grid Layout

    1. On larger screens (use a media query for this): on div.card, use display: grid instead of flex, and use grid-template-columns: 1fr 1fr;. This creates a grid formatting context (grid container) in which you can create your custom layout. In this case, a two column layout. The two column layout is then achieved with grid-template-columns: 1fr 1fr;, which basically says: create two columns of the same size. 1fr 1fr is here equal to 50% 50%.
    2. Remove width: 100% on both section.result and section.result2.
    3. Remove width: 500px on <main> and put max-width: 500px; on div.card instead. I also advice this when you use flexbox. The main reason for it is because it is a componen, which should be able to be reused on multiple pages (without setting width: 500px: on <main> all the time, because this can break your entire layout if you have other things on the webpage as well (but this is something for later on).

    If you do the above, you will see that it will give you the exact same result.

    I you want to learn more about Grid, then you can follow a crash course (Traversy Media) if you'd like.

    Flexbox variant (which you currently use)

    Instead of putting width: 100%; on both div.result and div.result2, you could have placed flex: 1; on both div.result and div.result2.

    Flex: 1; says: create two flex items of the same size (50% 50% because you have two flex items in your div.card container (flex container)).

    I hope you can do something with this, but if you still have questions, let me know. Don't see it as something you need to do, but rather something for later (you are always free to correct your solution).

    If I made a mistake somewhere in this post, feel free to correct me and keep building awesome things :D.

    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 1st-party linked stylesheets, and styles within <style> tags.

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.

Oops! 😬

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

Log in with GitHub