Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 4 years ago

Order Summary Component - HTML and CSS implementation

Alisha•20
@AlishaSo
A solution to the Order summary component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I'm pretty sure that a lot of the CSS added to size and/or align certain things is not the most optimized solution, if anyone could give me some feedback on that I'd appreciate it!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Raymart Pamplona•16,040
    @pikapikamart
    Posted almost 4 years ago

    Hey, awesome work on this one. Layout in general looks great but the layout is not responsive in terms of scaling right now.

    Sebastian Breit already gave great idea, just going to add some suggestions on this as well:

    • Don't style the html element, remove those and place them inside the body tag. You don't usually style the html element except for font-size and box-sizing.
    • Also, it would be great to have these base stylings:
    html {
      box-sizing: border-box;
      font-size: 100%;
    }
    
    *,
    *::before,
    *::after {
      box-sizing: inherit;
    }
    

    It would be long for me to explain this but trust me on this one, this would make handling the element easier than not setting the styling. You can search about it on this one.

    • Always have a main element to wrap the main content of your site. On this one, your #container should be using main instead of div.
    • Do not use margin to center the component, what you could do is that, remove the margin on the #container and on the body tag add:
        align-items: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin: 0;
        min-height: 100vh;
    

    This will make the layout always be centered dynamically. Also, always to set that margin: 0 on the body tag since by default there is an extra margin on the body.

    • When using img always include the alt attribute on it. If you don't add this, screen-reader would read the source path of the image which you don't want, either the alt is empty or not, include it always.
    • Do not use too many or just avoid in general using id attribute especially when using it as a styling selector, use class instead of id when selecting selector.
    • Same for music icon, alt is missing.
    • annual plan could use a heading tag like h2, since it gives overview on what the section would contain.
    • Do not just use span to wrap a text-content, always wrap with meaningful element like p tag, or wrap the span with a p tag.

    Aside from those, great work again on this one.

    Marked as helpful
  • Sebastian Breit•70
    @SebastianBr11
    Posted almost 4 years ago

    Instead of adding so much padding to the button, you could make the parent display flex and flex-direction column, so that the button automatically goes full length. You would then probably also have to add padding to the container and instead of adding the margin to each component separately you could add a flex gap.

    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