Interactive Portfolio Card (hover to flip)

Create a memorable and engaging portfolio with this interactive card that flips over on hover to reveal more information.

This is a high-impact way to add a layer of discovery to your portfolio grid. The front of the card displays a project image, while the back contains the project title, a short description, and a link to view more details.

Screenshot showing a portfolio card flipping from its front image to its back details.

Get Source Code Preview

About this Component

This is a CSS-only component that uses 3D transforms to create a realistic flipping animation. It provides a creative way to show more information without cluttering the initial view of your portfolio, inviting user interaction to discover the details on the "back" of the card.

Features

Code Breakdown

HTML Structure

The card's structure has three main parts. The outermost div (.flip-card) acts as a container to create the 3D space. The direct child (.flip-card-inner) is the element that will be rotated. Finally, inside this inner container are the two faces of the card: .flip-card-front and .flip-card-back.

CSS Styling

The 3D flip effect relies on a few core CSS properties:

  1. perspective: This is applied to the static outer container. It gives the child elements a 3D space to transform within, creating the sense of depth.
  2. transform-style: preserve-3d: This is applied to the inner element that rotates. It tells the browser that its children (the front and back faces) should be positioned in 3D space, not flattened onto a 2D plane.
  3. transform: rotateY(180deg): On hover, this is applied to the .flip-card-inner to create the rotation animation. This same transformation is applied to the back face (.flip-card-back) by default, so that it starts off facing away from the viewer.
  4. backface-visibility: hidden: This property is applied to both the front and back faces. It makes the "back" of an element transparent, so when the front face flips away from view, you don't see a mirrored version of it (you see the back face instead).

Code

Here is the complete, self-contained code. Simply update the image on the front and the text content on the back to build your interactive portfolio.

View Output