Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Product Preview Card Component - Main

John Tanโ€ข 140

@JohnEdgiTan

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Struggled a bit with responsive design but pulled it off. Question though, can there be a shorter way of doing my code with responsive design? Any comment would be highly appreciated. Thank you in advance.

Community feedback

@MelvinAguilar

Posted

Hello there ๐Ÿ‘‹. Good job on completing the challenge !

I have some suggestions about your code that might interest you.

HTML ๐Ÿท๏ธ:

  • Wrap the page's whole main content in the <main> tag.
  • Use the <footer> tag to wrap the footer of the page instead of the <div class="attribution">.
  • It's not necessary to wrap each element inside a div tag, you can use the element directly.
  • The element <div class="addcartbutton"> should be a button and not a div with a anchor tag inside.

CSS ๐ŸŽจ:

  • You should simply use min-width in the media query, I feel like you have repeated many styles without realizing it, so remove the media query with max-width and simply keep those styles as base styles, for example:
/* NOTE: Remove this media query */
/* @media only screen and (max-width: 35em) */

.right-col {
    background-color: var(--white);
    padding: 1.3rem;
    margin: 0;
    width: 100%;
    height: 100%;
    border-bottom-left-radius: 0.6em;
    border-bottom-right-radius: 0.6em;
}

@media only screen and (min-width: 35.1em)
.right-col {
    max-height: 22.7em;
    min-height: 22.7em;
    max-width: 15em;
    /* NOTE: These styles are repeated in the previous media query, if you remove the media query, there's no need to write them again. */
    /* background-color: var(--white); */
    /* margin: 0; */
    /* padding: 1.2em; */
    /* width: 100%; */
    /* height: 100%; */
    . . . 
}

I hope you find it useful! ๐Ÿ˜„ Above all, the solution you submitted is great!

Happy coding!

0

Please log in to post a comment

Log in with GitHub
Discord logo

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