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

Order summary component Chellenge

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

Solution retrospective


This is my first project challenge I'm confused a little about media query in CSS. Can you give some advice about this ? I accept all feedback for next project

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Katrien Schuermans•1,420
    @katrien-s
    Posted almost 4 years ago

    Hi, That's already a lot better. That weird 'jump' doesn't happen anymore. You know that you can drop the media-query with max-width? It works without it aswell. Try also to combine similar code:

    .container > p,
    .imgcontent > h4 {
     font-size: 0.875rem;
    }
    

    Besides, you're using calc for your font-size. This is a well-known trick that's being used to not have to write a media-query for changing the font-size. Just write in your body and it will work throughout the entire page.

    body {
      font-family: 'Red Hat Display', sans-serif;
      font-size: calc(60% + 0.8vmin);
      text-align: center;
      font-weight: 500;
      background-image: url(./order-summary-component-main/images/pattern-background-mobile.svg);
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center top;
      background-color: hsl(225, 100%, 94%);
      background-attachment: fixed;
    } 
    

    A lot of the code in your min-width-media-query is identical to the other code. You don't need to write the same code twice. Once you declared something to be a certain colour or font-size, it will continue to be this, unless you overwrite the code. In your code you declare background-color twice. You don't have to.

    Also, by writing something like this in your .container:

    margin-top: 5rem;
    margin: auto; 
    

    or this in your .plan:

    margin: auto;
    margin-right: 4rem;
    

    you overrule the margin setting. Like I said before, CSS is about Cascading, the last line overrules the previous line.

    Marked as helpful
  • P
    Katrien Schuermans•1,420
    @katrien-s
    Posted almost 4 years ago

    Hey, it looks good. It does indeed go a bit odd when I resize the screen. Somehow the font & images start growing and eventually wouldn't fit an iPhone SE-screen.

    I'm a bit confused too when I see your media-queries. You strangely put them all on top of your page, whereas I usually write mine underneath. The C in CSS stands for Cascading, which means, everything that comes underneath will replace what's written on top. This is something to keep in mind when writing your code. You've set a max- and min-width. One in rem, another in px. Why did you do this? (I'm trying to understand your code).

    Inside your media-query you also wrote div.container. When you use classes, you can just use .container. It seems to me you went a bit overboard with your specificity and declarations. The hardest thing about CSS is writing not too much code. Try looking into using variables, in order not to repeat yourself. And maybe do a total reset, instead of just margin and paddingin the *?

    box-sizing: border-box;
    margin: 0;
    padding: 0;```
    
    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