In this lesson:
Transition shadows
You can add transitions to box shadows so that interactions with them will be smooth. For example, you can add a hover effect to an element that will make the box shadow’s color grow darker. Here are the steps:
- Add a box shadow to an element and style with black color and 20% opacity
- From the States menu, select Hover
- Style the box shadow to have 55% opacity
- Go back to the States menu and select None (normal)
- At the bottom of the Style panel, under Effects add a transition and select Box shadow from the list
- Set the transition time, or leave it at the default 200ms
Notice that after you add the transition, the hover effect is a smooth fade between the None state and the Hover state. Without the 200ms transition, the hover effect would cut abruptly back and forth between the opacity levels. You can style the hover or pressed states with the box shadow anyway you’d like.
Create borders with box shadows
You can add multiple box shadows on a single element to create unique visual effects.
Learn more about box shadows and other effects.
Here’s an example of how to create a subtle border and shadow using multiple box shadows:
- Add an outside drop shadow and set the Blur and Distance to 0px and Size to 1px
- Set the color of the shadow rgba(0,0,0,0.1) - black with 10% opacity
- Add a second outside drop shadow. Set the Blur to 8px and Distance to 2px.
- Set the color also to rgba(0,0,0,0.1)