Skip to content

albina0104/product-preview-card-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Product preview card component solution

This is a solution to the Product preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout depending on their device's screen size
  • See hover and focus states for interactive elements

Screenshots

Desktop Mobile

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox

What I learned

  • How to make an image cover all of the parent element:
.card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

Also if a parent element has rounded corners, we have to use overflow: hidden; on the parent element in order to hide sharp corners of the image.

@media (hover: hover) {
    .btn:hover {
        background-color: var(--darker-cyan);
    }
}

Useful resources

  • How to name css classes - This article helped me to choose names for my classes. I really liked some pieces of advice from this article and will use them going forward. Especially these:
    • "Put the class name at the lowest possible level" is really useful advice, and the linked article explaining why.
    • BEM naming convention is a good idea: "double dash" means variation of the element, "double underscore" means children of the element.

Author

About

A solution to the "Product preview card component" challenge on Frontend Mentor

Topics

Resources

Stars

Watchers

Forks