Open In App

Tailwind CSS Transform Origin

This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. This class is used to specify the origin of the rotation of an element. It is the point about which an element is rotated. It can be used for both 2D and 3D rotations. In CSS, we can do that by using the CSS transform-origin property.

Transform Origin classes:



Syntax:

<element class="origin-{keyword}">...</element>

Example:






<!DOCTYPE html> 
<html
<head
    <link href
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
    rel="stylesheet"
</head
  
<body class="text-center"
    <h1 class="text-green-600 text-5xl font-bold"
       GeeksforGeeks 
    </h1
    <b>Tailwind CSS Transform Origin Class</b
    <div class="bg-green-300 
                mx-16
                p-4
                justify-between 
                grid grid-flow-col"> 
    <div class="bg-yellow-500 w-16 h-16">
    <div class="bg-no-repeat
                w-16 h-16 origin-center
                transform rotate-45" 
        style= 
        "background-image:url( 
    </div
    </div>
    <div class="bg-yellow-500 w-16 h-16">
    <div class="bg-no-repeat 
                w-16 h-16 origin-top-left
                transform rotate-45" 
        style= 
        "background-image:url( 
    </div>
    </div>
    <div class="bg-yellow-500 w-16 h-16">
    <div class="bg-no-repeat 
                w-16 h-16 origin-bottom-right 
                transform rotate-45" 
        style="background-image:url( 
    </div
    </div>
    <div class="bg-yellow-500 w-16 h-16">
    <div class="bg-no-repeat 
                w-16 h-16 origin-left
                transform rotate-45" 
        style="background-image:url( 
    </div>
    </div>
    </div
</body
</html

Output:


Article Tags :