Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 9 months ago

Product preview page remake. CSS and HTML only.

nimbo•100
@7bibi
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I retried doing this project! Many things I bet.

What challenges did you encounter, and how did you overcome them?

Responsive fonts. Responsive everything I guess.

What specific areas of your project would you like help with?

How can I make things responsive easily? Also what is best for me to learn next?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Asilcan Toper•2,960
    @KapteynUniverse
    Posted 9 months ago

    Hey nimbo, i saw your message and checked your code.

    Try not to use hard coded values like height: 90vh;, you can use min-max if you need. For example in your article.container height was causing issues, i deleted it and added a max-width: 25em and kept the width:90vw with this way article width is 25 em to a point and around 400-450px screen size it will be 90vw. I picked 25em randomly btw. This should correct the mobile layout.

    article.container {
      display: flex;
      flex-direction: column;
      overflow: auto;
      width: 90vw;
      max-width: 25em;
      /* height: 90vh; */
      border-radius: .5em;
      background-color: white;
    }
    

    For the desktop layout:

    I deleted 1024px and 1440px media queries. You can use them if you want for the font sizes, also use rem for the font sizes. There are a couple of videos of Kevin Powell about em/rem units, i recommend you to check them.

    /* 
    @media (min-width: 1024px) {
      article.container {
          height: 40vh;
          width: 80vw;
          overflow: auto;
      }
    }
    
    @media (min-width: 1440px) {
      article.container {
          width: 50vw;
          height: 65vh;
          overflow: hidden;
      }
    
      h2.reduced-price {
          font-size: 1.5em;
      }
    
      h1.perfume-name {
          font-size: 2.2em;
      }
    
      p.perfume-description {
          font-size: 1.2em;
      }
    
    }
      */
    

    and just changed max-width in the 760px media query to 45em. Again just a random pick. You can use another value, max-content or fit-content. With fit or max content it will be big on big screens again and needs to add justify-content: space-between; to the div.second-col.

    @media (min-width: 760px) {
    
      article.container {
          flex-direction: row;
      /*    height: 50vh; */
       /*    width: 90vw; */
       max-width: 45em;
        /*  overflow: auto; */
      }
    .
    .
    .
     }
    

    Also you don't need to repeat the codes after media queries unless if you used a between query like @media (min-width:400px) and (max-width:900px)

    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