CSS Perspective

Have you ever tried to display an element more like a 3D way? First thing which comes in our mind when we say 3D is z-index. However, it is completely not correct. In this blog we will learn how can we achieve an element to display in 3D with the help of perspective in CSS

What is Perspective?

It is nothing but a property found in CSS3 which can be given to the parent DOM element which will help the child element to have more like a 3D effect with proper attributes passed to it. The lower the value of perspective, higher is the 3D effect. Still not clear? Do not worry.

Today we will learn about perspective element in CSS with the help of a small real time example. Without wasting any further time lets dig deep into it.

Before we start let me quickly show by the end of this blog we will acheive something like this:


To build this we have a very plain and simple HTML which will look something like this:


For every <li> element we have we need the 3D display hence we will put perspective to the parent element which is <ul> in our case. Our CSS file structure for <ul> and <li> will look something like this:

If you closely look I have added mix-blend-mode property as well in order to have the <li> tiles stacked one upon other and part of it is transparent.

Our final CSS file will be as below:


If you are not very familier with mix-blend-mode property then not to worry, I will be writing another blog explaining in detail about it. So stay tuned.

Find the full code here:

Like what you read? Give MAINAK BHATTACHARYA a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.