How to set the angle in css

藏色散人
Release: 2023-01-07 11:45:53
Original
4046 people have browsed it

In CSS, you can set the angle through the rotate function. The syntax is "rotate(a)", where the parameter a specifies the degree of rotation of rotate(). When the parameter is positive, it rotates clockwise; the parameter When negative, it rotates counterclockwise.

How to set the angle in css

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer

How to set the angle of css?

rotate()

CSS’s rotate() function defines a way to rotate an element around a fixed point (specified by the transform-origin attribute) without Deformed transformation. The specified angle defines the measure of rotation. If the angle is positive, it rotates clockwise, otherwise it rotates counterclockwise. Rotation 180° is also known as point reflection.

The fixed point of the element's rotation - as mentioned above - is also called the transformation origin. This defaults to the center of the element, but you can set your own custom transform origin using the transform-origin property.

Syntax

specifies the degree of rotation of rotate(). When the parameter is positive, it rotates clockwise; when the parameter is negative, it rotates counterclockwise. A 180° rotation is called a point inversion.

rotate(a)
Copy after login

The value a is an , indicating the angle of rotation. Positive angles represent clockwise rotation, and negative angles represent counterclockwise rotation.

How to set the angle in css

Example

HTML

<div>Normal</div>
<div class="rotated">Rotated</div>
Copy after login

CSS

div {
  width: 80px;
  height: 80px;
  background-color: skyblue;
}
.rotated {
  transform: rotate(45deg); /* Equal to rotateZ(45deg) */
  background-color: pink;
}
Copy after login

Result

How to set the angle in css

【Recommended learning: css video tutorial

The above is the detailed content of How to set the angle in css. 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