Perspective Grid w/Animation // CSS Grid

Size
3,531 Kb
Views
2,024

How do I make an perspective grid w/animation // css grid?

I often see this type of skewed image design for apps and websites, as well as graphic design portfolios. What if we animated that into an image gallery? This gallery utilizes CSS Grid Layout and CSS3 perspective to create something a little unique.. What is a perspective grid w/animation // css grid? How do you make a perspective grid w/animation // css grid? This script and codes were developed by Brian Haferkamp on 27 January 2023, Friday.

Perspective Grid w/Animation // CSS Grid Previews

Perspective Grid w/Animation // CSS Grid - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Perspective Grid w/Animation // CSS Grid</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="view-gallery"> <button>View Gallery</button>
</div>
<ul> <li class="box box-1"></li> <li class="box box-2"></li> <li class="box box-3"></li> <li class="box box-4"></li> <li class="box box-5"></li> <li class="box box-6"></li>
</ul> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Perspective Grid w/Animation // CSS Grid - Script Codes CSS Codes

* { box-sizing: border-box;
}
ul { list-style: none; padding: 0; -webkit-perspective: 3000px; perspective: 3000px; max-width: 768px; margin: auto; padding: 2rem;
}
@media (min-width: 768px) { ul { display: -ms-grid; display: grid; -ms-grid-columns: (1fr)[2]; grid-template-columns: repeat(2, 1fr); -ms-grid-rows: (1fr)[2]; grid-template-rows: repeat(2, 1fr); grid-gap: 1rem; }
}
.box { width: 100%; height: 200px; margin: -3rem 0 0; -webkit-transform: translateY(10vh) skew(60deg, -15deg) rotateX(40deg); transform: translateY(10vh) skew(60deg, -15deg) rotateX(40deg); box-shadow: -5px 5px 30px 1px rgba(0, 0, 0, 0.3); -webkit-transition: all 300ms ease; transition: all 300ms ease;
}
.box-1 { background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/01ZeHnK3F_4_2000px.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.box-2 { background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/0st9yhngses-benjamin-child.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.box-3 { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/Great_Wave_off_Kanagawa2_cr.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.box-4 { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/bfezchfpm2i-igor-ovsyannykov.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.box-5 { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/esawhr5fhn8-oskar-krawczyk.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.box-6 { background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/495197/joshua-sortino-5581_cr.jpg); background-position: center; background-size: cover; background-repeat: no-repeat;
}
.view-gallery { text-align: center; margin: 5vh 0;
}
.view-gallery button { background: red; color: white; padding: 1rem 2rem; border: 0; -webkit-transition: background 200ms ease; transition: background 200ms ease;
}
.view-gallery button:hover { cursor: pointer; background: rgba(255, 0, 0, 0.8);
}
.animated { -webkit-transform: translateY(0) skew(0, 0) rotateX(0deg); transform: translateY(0) skew(0, 0) rotateX(0deg); margin: 0 0 1rem;
}
@media (min-width: 768px) { .animated { margin: 0; }
}

Perspective Grid w/Animation // CSS Grid - Script Codes JS Codes

$('.view-gallery button').on('click', function() { $('.box').toggleClass('animated'); // $('ul').css({ // 'max-width' : '100%' // });
});
Perspective Grid w/Animation // CSS Grid - Script Codes
Perspective Grid w/Animation // CSS Grid - Script Codes
Home Page Home
Developer Brian Haferkamp
Username brianhaferkamp
Uploaded January 27, 2023
Rating 4
Size 3,531 Kb
Views 2,024
Do you need developer help for Perspective Grid w/Animation // CSS Grid?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Brian Haferkamp (brianhaferkamp) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!