Split Image on Hover Using CSS

Split Image on Hover Using CSS
Code Snippet:Broken Image Hover Effect
Author: Website Mentor
Published: January 10, 2024
Last Updated: January 22, 2024
Downloads: 501
License: MIT
Edit Code online: View on CodePen
Read More

This code snippet creates a split image effect on hover using CSS. It uses the clip-path property to divide the image into four equal parts, and then uses the transform property to move and rotate the parts on hover.

You can use this code snippet to create a visually appealing and engaging hover effect for images. Furthermore, it can be used on any type of image, but it is particularly well-suited for images with a lot of detail.

How to Create Split Image Effect On Hover Using CSS

1. Begin by creating the HTML structure. Copy the following code, which includes a container <div> with four nested <span> elements. These spans will represent the segments of your image.

<div class="image">

2. Now, style each <span> element with background images and clip-path properties. These properties determine the shape and position of each segment. Implement hover effects to induce dynamic transformations. Each segment gracefully translates and rotates, creating a captivating animation on hover.

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

body {
  height: 100vh;
  background: #012;
  display: grid;
  place-items: center;
.image {
  width: 500px;
  height: 350px;
  position: relative;
  cursor: pointer;
.image span {
  position: absolute;
  background: url(https://picsum.photos/id/182/2896/1944) no-repeat center/cover;
  inset: 0;
  transition: 0.6s ease-in-out;
span:nth-child(1) {
  clip-path: polygon(0 0, 50% 0, 50% 50%, 0 50%);
  transition-delay: 0;
span:nth-child(2) {
  clip-path: polygon(50% 0, 100% 0, 100% 50%, 50% 50%);
  transition-delay: 0.25s;
span:nth-child(3) {
  clip-path: polygon(0 50%, 50% 50%, 50% 100%, 0 100%);
  transition-delay: 0.5s;
span:nth-child(4) {
  clip-path: polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%);
  transition-delay: 0.75s;
/* Hover Effects */
.image:hover span:nth-child(1) {
  transform: translate(-40px, -60px) rotate(-15deg);
.image:hover span:nth-child(2) {
  transform: translate(40px, -100px) rotate(25deg);
.image:hover span:nth-child(3) {
  transform: translate(-40px, 80px) rotate(15deg);
.image:hover span:nth-child(4) {
  transform: translate(40px, 80px) rotate(-15deg);

Feel free to customize the dimensions, positions, and hover effects to align with your creative vision. Experiment with different images and transition timings to achieve the desired visual impact.

That’s all! hopefully, you have successfully created Split Image On Hover Using Css. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link