smartinsdev / card-component-mentor

The challenge is to build out this product preview card component and get it looking as close to the design as possible.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Screenshot

Desktop

The screenshot of the card component for device desktop

Mobile

The screenshot of the card component for device mobile

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow

What I learned

This project I learned about using the Picture tag along with the Source tag to make the image responsive according to screen size. I also used the Mobile-First methodology for the first time

See how it looks below:

<picture>
  <source media="(min-width: 770px)" srcset="./images/image-product-desktop.jpg">
  <img src="./images/image-product-mobile.jpg" alt="image-product-mobile">
</picture>
/* Desktop */
@media (min-width: 770px) {
  ...
}

Author

About

The challenge is to build out this product preview card component and get it looking as close to the design as possible.


Languages

Language:CSS 70.7%Language:HTML 29.3%