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

P
Nick 260

@nn-code80

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


Feedback on best practice coding would be much appreciated. Thanks!

Community feedback

Bryan Li 3,550

@Zy8712

Posted

Your site looks great! The only thing I'd alter is the use of <div class="button"> inside of your <button> tags as it is sort of redundant in my opinion. So the main thing I'd say you should work on is the formatting of your code and elimination of redundant code. In this case you should be able to implement the button just using:

        <button>
          <img src="./images/icon-cart.svg" alt="cart_icon"> Add to Cart
        </button>

as the bare minimum. Along with some css code like this:

button{
  width: 100%;
  height: 45px;
  color: var(--theme-white);
  background-color: var(--theme-dark-cyan);
  border-style: none;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-theme-montserrat);
  font-weight: 700;
}

button > img{
  margin-right: 10px;
}

Aside from that I'd say you have some good practices such as the use of semantic tags and the abscence of redundant alt text for images. Nice work 👍

Marked as helpful

1

P
Nick 260

@nn-code80

Posted

Hello Bryan, thanks for taking the time to analyze my coding and share these tips. I appreciate it. @Zy8712

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