当前位置:网站首页>Detailed explanation of transform origin attribute
Detailed explanation of transform origin attribute
2022-07-07 07:14:00 【Luqi zz】
transform-origin Base point for animating ( Center point ) , Applicable to all block level elements and some inline elements .
Must cooperate transform Use By default , The action reference point of the element is the center of the element box
You can set the value of nine positions : horizontal direction : left center right
0 50% 100%
vertical direction : top center bottom
The default value is :50% 50% , be relative to center center
Two ways of writing ,
eg:
transform-origin: left;
transform-origin:0;
grammar :
transform-origin: x-axis y-axis z-axis;

Attribute value details
<div class="outer">
<div class="inner"></div>
<div class="inner"></div>
</div>1. The default value is , Rotate at its origin 45deg
.outer {
width: 100px;
height: 100px;
background-color: #6a5acd8c;
margin: 200px;
position: relative;
}
/* (1) Default rotation , Red is the base point The default value is transform-origin: 50% 50% 0;*/
.inner {
transform: rotate(45deg);
/* transform-origin: 50% 50% 0; */
width: 100%;
height: 100%;
background-color: #6a5acdeb;
}
.outer .inner:nth-child(2){
width: 5px;
height: 5px;
background-color: red;
transform: none;
position: absolute;
top: 50px;
left: 50px;
}
2. Rotate at the top 180deg
.outer {
width: 100px;
height: 100px;
background-color: #6a5acd8c;
margin: 200px;
position: relative;
}
/* (2) Rotate at the top 180deg */
.inner {
transform: rotate(180deg);
transform-origin: 50% 0;
width: 100%;
height: 100%;
background-color: #6a5acdeb;
}
.inner:nth-child(2) {
width: 5px;
height: 5px;
background-color: red;
transform: none;
position: absolute;
top: -2.5px;
left: 50px;
} 
3. Rotate on the right 150deg
/* Rotate on the right 150deg Red is the base point */
.inner {
transform: rotate(150deg);
transform-origin: 100% 50%;
width: 100%;
height: 100%;
background-color: #6a5acdeb;
}
.inner:nth-child(2) {
width: 5px;
height: 5px;
background-color: red;
transform: none;
position: absolute;
top: 47.5px;
left: 97.5px;
}
4. Rotate in the upper left corner 20deg Red is the base point
.inner {
transform: rotate(-20deg);
transform-origin: 0 0;
width: 100%;
height: 100%;
background-color: #6a5acdeb;
}
.inner:nth-child(2) {
width: 5px;
height: 5px;
background-color: red;
transform: none;
position: absolute;
top: -2.5px;
left: -2.5px;
}
From the above example, we can see , The offset position represented by the attribute value , Knowing the offset position represented by each attribute value can flexibly make the element rotate according to a certain benchmark .
边栏推荐
- Abnova membrane protein lipoprotein technology and category display
- Fast quantitative, abbkine protein quantitative kit BCA method is coming!
- OOM(内存溢出)造成原因及解决方案
- $refs:组件中获取元素对象或者子组件实例:
- From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
- 云备份项目
- Sword finger offer high quality code
- Stack Title: nesting depth of valid parentheses
- Master-slave replication principle of MySQL
- from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
猜你喜欢

Release notes of JMeter version 5.5

. Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context

Abnova immunohistochemical service solution

DHCP路由器工作原理

LC 面试题 02.07. 链表相交 & LC142. 环形链表II

MySQL SQL的完整处理流程

jdbc数据库连接池使用问题

Pass child component to parent component

How does an enterprise manage data? Share the experience summary of four aspects of data governance

Leetcode t1165: log analysis
随机推荐
CompletableFuture使用详解
Tool class: object to map hump to underline underline hump
How can flinksql calculate the difference between a field before and after update when docking with CDC?
MySQL SQL的完整处理流程
请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
Reflection (II)
【JDBC以及内部类的讲解】
Kuboard无法发送邮件和钉钉告警问题解决
Explain Bleu in machine translation task in detail
How to share the same storage among multiple kubernetes clusters
Non empty verification of collection in SQL
Freeswitch dials extension number source code tracking
云备份项目
Pass child component to parent component
Answer to the second stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
Esxi attaching mobile (Mechanical) hard disk detailed tutorial
MySQL binlog related commands
Config分布式配置中心
readonly 只读
异步组件和Suspense(真实开发中)