Skip to content

mbdelarosa/stats-preview-card-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Stats preview card component solution

This is a solution to the Stats 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

Screenshot

Links

My process

Built with

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

What I learned

Through this challenge, I was able to accomplish the following:

  • Learn and implement Grid, and use it with Flexbox
  • Try out the BEM naming convention
  • Use the <picture> tag to serve images in different screen sizes
  • Use the mix-blend-mode and opacity properties to create a gradient effect on the picture
  • Learn that changing the display property of a list will sometimes remove the list semantics, but can be fixed by adding role="list" to the <ul> and role="listitem" to the <li>

Some pain points I encountered while doing this challenge:

  • Scrolling and display issue when I used Flexbox on the <body> instead of grid for mobile display
    • To fix this, I decided to also use Grid for the mobile display and added a max-width for both mobile and desktop view
  • Getting the gradient effect on the picture
    • I had to play around with the .card-component__image and img css blocks for this, realizing that I had to set the background color on the parent .component__image and the opacity on the child img
  • Picture was shrinking inside the container when resized
    • Had to set the width and height to 100% for both picture and img

Continued development

This was my first encounter with Grid, so I'm looking forward to using it again in future challenges. I'm also interested to read up on clamp() and when to use it, as I'm wondering if this could be a better tool for resizing text/images

Useful resources

Author

About

Solution for the Stats Preview Card Component challenge on Frontend Mentor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published