Open In App
Related Articles

Tailwind CSS Transform Origin

Improve Article
Improve
Save Article
Save
Like Article
Like

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:

  • origin-center: This class is used to set the element’s origin as center.
  • origin-top: This class is used to set the element’s origin as top.
  • origin-top-right: This class is used to set the element’s origin as top-right.
  • origin-right: This class is used to set the element’s origin as right.
  • origin-bottom-right: This class is used to set the element’s origin as bottom-right.
  • origin-bottom: This class is used to set the element’s origin as bottom.
  • origin-bottom-left: This class is used to set the element’s origin as bottom-left.
  • origin-left: This class is used to set the element’s origin as left.
  • origin-top-left: This class is used to set the element’s origin as top-left.

Syntax:

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

Example:

HTML




<!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:


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 23 Mar, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials