3D Animated Boxes Grid Using Pure CSS
This animation features a clever 3D box effect that moves in a rotating sequence across a grid layout. Built entirely with HTML and CSS, the animation creates a cube-style appearance where each box consists of four sides, animated through a series of seamless transitions. This layout combines perspective, motion, and depth — all without a single line of JavaScript.
Layout Description
The structure begins with a container holding four boxes. Each box is made up of four inner faces, representing different sides of a cube. The faces are positioned and rotated to give a 3D illusion. All boxes are arranged in a square grid format and are placed using translation values along the horizontal and vertical axes.
The main container applies a 3D transformation to tilt the entire view, giving it an isometric angle. This rotation — combined with the inner cube faces — creates a 3D visual from a 2D layout.
Visual Elements
Each box is made up of four separate sides:
A top face that appears in the default view
A right face rotated to create depth
A bottom face angled to give vertical perspective
A backside that remains hidden below, giving the box its complete shape
Each face is shaded with different tones of blue, from bright to dark, giving the cube a realistic lighting effect. The use of layered divs and CSS variables helps maintain clean, reusable styling across all faces.
Animation Flow
The animation works through keyframes assigned to each box in the grid. Each box has a separate animation path, and they move one after the other in a smooth loop. The keyframes are defined to shift each box in a specific direction and timeline, allowing the illusion of continuous motion.
As the animation runs:
One box moves from the left to the right
Another moves upward and then right
A third moves downward across the grid
The last moves diagonally, completing the loop
These animations create the effect of tiles shifting positions on a virtual board, almost like a puzzle or conveyor system.
3D and Perspective Effects
The design relies heavily on 3D CSS features like:
transform-style: preserve-3dto maintain depth across nested elementstranslateZto lift elements off the base surfacerotateXandrotateYto rotate individual cube facestransform-originandtransformon the parent to apply angled perspectives
These effects combine to give the entire layout a sense of realism and movement, even though everything is built from flat div elements.
Use Case and Customization
This animated box grid can be used as a background effect, a loading animation, or a visual centerpiece in landing pages and modern UI layouts. It’s fully responsive to timing changes — adjusting the animation duration or cube size can instantly modify the pacing and appearance.
Customization is also easy. You can:
Change the colors for different cube faces
Adjust the size of the boxes using CSS variables
Modify animation paths or timing to create new motion patterns
Final Result
This pure CSS layout creates an impressive 3D animated effect that’s visually rich and performance-friendly. With careful use of transforms and keyframes, the layout achieves depth, motion, and timing — all without a single script. It’s a perfect example of how creative animation can be done using only HTML and CSS.
This code uses HTML and CSS only — no JavaScript included.
Copyright – 2025 Nawsome
Permission is freely granted to anyone who obtains a copy of this software and its accompanying documentation files (referred to as “the Software”), allowing them to use, copy, modify, merge, publish, distribute, sublicense, and even sell copies of the Software. Additionally, users are allowed to permit others to use the Software under these same terms.
It is required that the above copyright notices and this permission notice be included in all versions or significant portions of the Software.
Please note, the Software is provided “as is”, without any form of warranty—express or implied. This includes, but is not limited to, warranties of merchantability, fitness for a specific purpose, or non-infringement. Under no circumstances shall the original authors or rights holders be held responsible for any claims, damages, or other liabilities that may arise from the use of the Software, whether through legal action, negligence, or otherwise.
All code on Freeofcosts.com is reviewed before publishing. Each post includes a live code editor with real-time preview, so you can experiment and learn by doing. Most code is open-source and free to use or modify under respective licenses.



