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

Responsive preview card using html and css

P
praistylesā€¢ 90

@praistyles

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

P
Marc Francisā€¢ 520

@marcfranciss

Posted

Great solution!

You may just fix a little spacing error on your 'cart' class so that the hover animation will be on the button itself not on the figure and text. Also, if you're not using the semantic element 'button', you may add 'cursor: pointer' so it will be considered a button.

.card:hover {
 background-color: #003622;
 cursor: pointer;
}

Keep up the great coding!

Marked as helpful

0

P
praistylesā€¢ 90

@praistyles

Posted

@marcfranciss Thanks for the feedback, really appreciate. Can you please assist with how you tackle the images (mobile& desktop img on html and also how to style) l really struggled.

0
P
Marc Francisā€¢ 520

@marcfranciss

Posted

@praistyles You're welcome!

About images, I always set it to follow its container:

img-container {
  border-radius: 5px;
  overflow: hidden;  // for the image to follow container's border-radius if it is set
  (other css...)

   img {
     width: 100%;      // to follow container's width 
     height: 100%;     // to follow container's height 
     object-fit: cover;  // so the image is taking all the space of container
   }
}

Then, you can style your container depending on your needs and the image will follow it.

Hope this helps. Cheers! šŸ»

Marked as helpful

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