Home  >  Article  >  Web Front-end  >  How to set the angle in css

How to set the angle in css

藏色散人
藏色散人Original
2021-07-27 11:09:274011browse

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)

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>

CSS

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

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!

Statement:
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
Previous article:How to hide div in cssNext article:How to hide div in css