BEYOND THE BASICS

Creating Hover Effects

Creating your own custom hover effects is a subtle yet powerful interaction that transforms ordinary elements into dynamic experiences, engaging visitors and guiding their journey. 


Beyond simple aesthetics, hover effects serve distinct purposes:

  • Enhanced Interactivity: They add a playful touch, turning passive elements into engaging experiences.

  • Visual Guidance: They subtly direct visitors' attention towards key areas or calls to action.

  • Branding Reinforcement: They can subtly reflect your brand personality and convey a sense of dynamism.


How To Create A Hover Effect Code

The concept of a hover code is fairly simple. You start with your unique ID or selector - what you want the person to hover over with their cursor. Then you add the text :hover to your code, like this: 


.fluid-image-container:hover


After you’ve stated that you're changing a specific thing in a hover state, you need to specify what about the thing you are changing. In this example below, we’re adding a grayscale filter to that image whenever someone is hovering over it with their cursor. 

.fluid-image-container:hover {
filter: grayscale(1)
}

How To Increase Duration for Smoother Transitions

The magic of hover effects lies in their smooth, seamless transformations. This is achieved through the transition property in CSS. It defines the duration and easing function applied to property changes on hover. Here's how to use it:

.fluid-image-container:hover {
filter: grayscale(1);
transition: filter 2s
}

In this code, transition specifies the property undergoing change (e.g., filter). The value 2s defines the transition duration in seconds. There are additional transition properties, but these basic ones are all you need to get started!

Pro tip: if you set a transition timing like 2 seconds for your hover, consider setting one for the content returning to it’s normal state; that keeps it a smooth transition in both directions. Here is an example of that code with a slower transition to the normal state: 

.fluid-image-container:hover {
filter: grayscale(1);
transition: filter 2s
}

.fluid-image-container {
transition: filter 2s
}

You Can Change More Than Colors

While adding filters and changing colors is common, hover effects offer a vast canvas for exploration. Here are some exciting properties to tweak:

  • Border: Modify width, style, and color for subtle outlines or bold transformations

  • Box-shadow: Add depth and dimension with subtle shadows

  • Opacity: Make elements fade in or out for a ghostly effect

Remember to explore different transition durations and easing functions to achieve diverse effects and try to combine multiple property changes for unique interactions. And most importantly, have fun with your Squarespace website.


THE TERM “SQUARESPACE” IS A TRADEMARK OF SQUARESPACE, INC.
THIS CONTENT IS NOT AFFILIATED WITH SQUARESPACE, INC.

All Rights Reserved © 2024 by InsideTheSquare.co; 7202 NE HWY 99 #106-167; VANCOUVER WA 98665

For support, please email support@insidethesquare.co

Previous
Previous

Font & Text Property Guide

Next
Next

Guide to Gradients