How to use rotate to set the rotation angle in css3

WBOY
Release: 2022-01-24 15:47:30
Original
2174 people have browsed it

In css3, you can use the transform attribute with the rotate() function to set the rotation angle of the element. The transform attribute is used to specify the rotation, scaling and other operations of the element. The rotate() function is used to define the 2D rotation of the element. The syntax is " Element {transform:rotate(angle)}".

How to use rotate to set the rotation angle in css3

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

css3How to use rotate to set the rotation angle

The transform attribute applies 2D or 3D transformation to the element. This property allows us to rotate, scale, move or tilt the element.

This attribute can be used with the rotate() function to set the rotation angle.

The rotate() function defines 2D rotation and specifies the angle in the parameters.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  div{
    width:100px;
    height:100px;
    border:1px solid #000;
    transform:rotate(45deg);
  }
  </style>
</head>
<body>
  <div></div>
</body>
</html>
Copy after login

Output result:

How to use rotate to set the rotation angle in css3

(Learning video sharing: css video tutorial)

The above is the detailed content of How to use rotate to set the rotation angle in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!