• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

rotate() | CSS-Tips

Admin by Admin
May 20, 2026
Home Coding
Share on FacebookShare on Twitter


The CSS rotate() perform spins a component both clockwise or counterclockwise in a 2D airplane. It’s considered one of many rework capabilities used within the rework property.

For instance, utilizing rotate() we are able to rotate the hand across the clock:

.seconds-hand {
  rework: rotate(var(--deg));
  transform-origin: backside heart;
}

For rotating components tri-dimensionally, think about using rotateX() and rotateY().

The rotate() capabilities is outlined within the CSS Transforms Module Degree 1 specification.

Syntax

rotate() = rotate( [  |  ] )

Arguments

/*  */
rotate(90deg) /* Rotates 90 levels clockwise  */
rotate(-180deg) /* Rotates 180 levels counterclockwise */

/*  in turns */
rotate(0.25turn) /* Rotates a quater flip clockwise. */
rotate(1turn)    /* Rotates a full 360-degree flip. */

/*  in radians */
rotate(1.57rad)  /* Rotates ~90 levels clockwise. */
rotate(-3.14rad) /* Rotate ~180 levels counterclockwise. */

The rotate() perform accepts a single  argument, which dictates the route of its spin. A constructive argument spins the component clockwise, whereas a unfavorable argument spins the component counterclockwise.

The  kind has 4 items to select from:

  • deg: One diploma is 1/360 of a full circle.
  • grad: One gradian is 1/400 of a full circle.
  • rad: A radian is the size of a circle’s diameter across the form’s arc. One radian is 180deg, or 1/2 of a full circle. One full circle is 2π radians, which is the same as 6.2832rad or 360deg.
  • flip: One flip is one full circle. So, midway round a circle is the same as .5turn, or 180deg.

Additionally, rotate() spins the component round its heart axis. To vary the rotation level, we’ve got to go a particular level to the transform-origin property that’ll function the axis of rotation.

Primary utilization

The rotate() perform is the spine of among the fundamental animations you’ve most certainly come throughout on, like switching from “+” to “x” when an accordion is opened. We will try this by rotating the “+” image by 45deg.

So, if we’ve got a button like this:

We will sprinkle a bit of JavaScript in there to set off an .lively class when the button is clicked, which rotates the icon:

.toggle.lively .icon {
  rework: rotate(45deg);
}

Have you ever seen these menus that change from a hamburger icon to a closing “X” icon when a menu dropdown or sidebar is opened? That’s a rotation, too!

We begin with three spans which might be styled as horizontal traces:

.bar {
  width: 100%;
  peak: 4px;
  background: #333;
  transition: rework 0.3s ease, opacity 0.3s ease;
}

Discover we’ve got a transition in there in order that, when the button is clicked and the rotation occurs (once more, utilizing JavaScript to toggle on an .lively class), the spans rework easily:

.hamburger.lively .high {
  rework: translateY(14px) rotate(45deg);
}

.hamburger.lively .center {
  opacity: 0;
}

.hamburger.lively .backside {
  rework: translateY(-14px) rotate(-45deg);
}

Instance: Loading icons

We will additionally use rotate() for loading indicators. Loading indicators often spin whereas a web page is, you already know, loading. A standard instance is a semi-circle that spins till the web page is finished loading.

The .spinner makes use of the CSS animation shorthand to outline an infinite spinning loading indicator, and the @keyframes spin defines a 360deg spin with the rotate() perform.

.spinner {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    rework: rotate(360deg);
  }
}

Now the spinner retains on a’spinning:

Instance: Rotating textual content

Rotating issues isn’t all the time about animation! We will, for instance, place one thing like a “Function” label subsequent to a weblog put up and rotate it vertically for an attention-grabbing visible impact.

.vertical-header {
  writing-mode: vertical-rl;
  rework: rotate(180deg);
}

Demo

Let’s have a look at a extra complicated animation to show simply how neat it’s to rotate() issues with CSS. For those who “Rerun” the demo, you’ll see the photograph swing forwards and backwards. It’s also possible to drag the photograph from left to proper to rotate it.

Specification

The CSS rotate() perform is outlined within the CSS Transforms Module Degree 1 specification, which is at present in Editor’s Draft.

Browser assist


Article

on

Aug 28, 2019



Are you able to rotate the cursor in CSS?


Article

on

Mar 8, 2023



Making a Clock with the New CSS sin() and cos() Trigonometry Capabilities


Article

on

Mar 30, 2020



How They Match Collectively: Rework, Translate, Rotate, Scale, and Offset


Article

on

Mar 2, 2021



Find out how to Animate the Particulars Aspect


Article

on

Sep 19, 2022



Making a Actual-Time Clock With a Conic Gradient Face


Article

on

Sep 26, 2025



Recreating Gmail’s Google Gemini Animation


Article

on

Nov 20, 2017



Recreating the Apple Watch Breathe App Animation


Article

on

Jun 1, 2020



Rotated Desk Column Headers… Now With Fewer Magic Numbers!

Associated

Tags: CSSTricksRotate
Admin

Admin

Next Post
What Is Agentic website positioning? And Learn how to Get Began This Week

What Is Agentic website positioning? And Learn how to Get Began This Week

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

All animal familiars in Hades 2

All animal familiars in Hades 2

September 29, 2025
Credulous

A convincing argument | Seth’s Weblog

November 21, 2025

Trending.

Nsfw Chatgpt Options – Examples I’ve Used

Nsfw Chatgpt Options – Examples I’ve Used

October 13, 2025
ModeloRAT and Mistic Backdoor Exercise Linked to Ransomware Preliminary Entry Dealer

ModeloRAT and Mistic Backdoor Exercise Linked to Ransomware Preliminary Entry Dealer

June 24, 2026
Cisco Catalyst SD-WAN Zero-Day CVE-2026-20245 Exploited to Acquire Root Entry

Cisco Catalyst SD-WAN Zero-Day CVE-2026-20245 Exploited to Acquire Root Entry

June 25, 2026
Web Information Caps Defined: The right way to Keep away from Overages and Discover Limitless Plans

Web Information Caps Defined: The right way to Keep away from Overages and Discover Limitless Plans

September 23, 2025
Hijacked npm and Go Packages Use VS Code Duties to Deploy Python Infostealer

Hijacked npm and Go Packages Use VS Code Duties to Deploy Python Infostealer

June 29, 2026

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

New Fallout Sport Reportedly in Growth at Obsidian, Avowed 2 Canceled

New Fallout Sport Reportedly in Growth at Obsidian, Avowed 2 Canceled

July 8, 2026
CISO’s information to hiring for the suitable cybersecurity expertise

CISO’s information to hiring for the suitable cybersecurity expertise

July 8, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved