Skip to content

DarrickFauvel/fem2407-blog-preview-card-next

Repository files navigation

Frontend Mentor - Blog preview card solution

This is a solution to the Blog preview card 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:

  • See hover and focus states for all interactive elements on the page

Screenshot

mobile

desktop

Links

My process

Built with

  • Mobile-first workflow
  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • React - JS library
  • Next.js - React framework
  • Tailwind CSS - For styles

What I learned

I learned how to apply styling based on the parent state using the Tailwind CSS 'group' modifier.

Here's an example:

<div className="group" id="my-card">
  <h2>Big Title</h2>
  <p>lorem ipsum something something...</p>
  <button className="group-hover:bg-green-600">click me</button>
</div>

When hovering the mouse over ANY part of the card, the background color of the inner button element will turn green.

Continued development

I may use an API to render multiple cards in a grid.

Useful resources

  • Tailwind CSS - This helped me learn about the 'group' modifier.

Author