CSS3 Perspective Tutorial


CSS3 Perspective Tutorial with Webkit Transform Element
Here is our next CSS3 Tutorial about changing the perspective of a DIV Element.
The perspective property defines how many pixels a 3D element is placed from the view. This property allows you to change the perspective on how 3D elements are viewed.
This property only affects 3D transformed elements.


     Syntax: perspective: number|none;

                    Number- How many pixels the element is placed from the view

Browser Support: Chrome and Safari

Code:


<!DOCTYPE html>
<html>
<head>
<style>
#div1
{
position: relative;
height: 150px;
width: 150px;
margin: 50px;
padding:10px;
border: 4px solid green;
perspective:150;
-webkit-perspective:150; /* Safari and Chrome */
}

#div2
{
padding:50px;
position: absolute;
border: 5px solid blue;
background-color: yellow;
transform: rotateX(45deg);
-webkit-transform: rotateX(45deg); /* Safari and Chrome */
}
</style>
</head>
<body>
<div id="div1">
<div id="div2">
<a href="http://www.tutoraialscode.com">"Tutorials   Code</a>
</div>
</div>

</body>

</html>





































You can change the Perspective into any other value. 


No comments:

Post a Comment