Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 3 years ago

Product preview card component

Nelson Rosario•50
@NellyisDevv
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


  • I found it a bit difficult to find what width would work with mobile view!

  • Is there anything I could have done better with this challange I know there is a bunch of minor things that should be adjusted and changed to make the project more clean and just better across different devices

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Samuel Llibre Santos•400
    @Zyruks
    Posted about 3 years ago

    Hey how is everything? Hope all good.

    Here my Tips:

    1: for the image to occupy the 100% of the height first put

    .perfume-container {
     max-height : 600px;
    }
    
    .perfume-picture {
    width : 50%;
    }
    .perfume-container .perfume-picture img {
     height: 100%;
    }
    

    that should make the img 100% height.

    2: to align the content to the center you can delete the margin on .perfume-container and add display:flex to body and flex-direction column.

    If you need help with anything just text me me ;)

    Marked as helpful
  • Antonain E.•220
    @antoebtfr
    Posted about 3 years ago

    Hi,

    Excuse me in advance if I make some English mistakes

    @media only screen and (min-width: 375px) and (max-width: 760px)

    There is two things

    1. I think this exercise wanted to give 375px as the value for mobile devices so it needed to be set as the max-width

    2. With this code, your website reverts to desktop format below the min-width value which is not desirable. ( + the modal is not correct anymore, the white background on the right side disappears )

    For the details :

    The " Add to Cart " button is not centered horizontally

    
    .perfume-container .perfume-information button img {
         height: 2vh; 
         align-items: center; (not needed)
         position: relative; (not needed)
        left: 24px;
    }
    
    .perfume-container .perfume-information button #text {
        /* position: relative; */ (not needed)
        /* left: 80px; */ (not needed)
        bottom: 3px;
        font-family: "Montserrat", serif;
        font-weight: 600;
    
    .perfume-container .perfume-information button { 
        [...]
        cursor: pointer;
        position: relative; (not needed)
        right: 5px;
       /* New lines */
        justify-content : center;
        align-items: center;
    

    To simplify responsive, you can use the vw, vh units and max/min-width with absolute value to delimitate if necessary

    Feel free if you want to ask for more tips and your website is pretty good btw !

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