{"id":2433,"date":"2023-11-14T11:57:52","date_gmt":"2023-11-14T03:57:52","guid":{"rendered":""},"modified":"2023-11-14T11:57:52","modified_gmt":"2023-11-14T03:57:52","slug":"CSS transform-origin","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/2433.html","title":{"rendered":"CSS transform-origin"},"content":{"rendered":"
\u5982\u679c\u4ec5\u6307\u5b9a\u4e00\u4e2a\u503c\uff0c\u5219\u8be5\u503c\u5fc5\u987b\u662f\u957f\u5ea6\u6216\u767e\u5206\u6bd4\uff0c\u6216\u8005\u662fleft\uff0ccenter\uff0cright\uff0ctop\uff0c<\/strong>\u548cbottom<\/strong>\u4e4b\u4e00\u3002 <\/span>
\n\u5982\u679c\u6211\u4eec\u6307\u5b9a\u4e24\u4e2a\u503c\uff0c\u5219\u7b2c\u4e00\u4e2a\u503c\u5fc5\u987b\u662f\u957f\u5ea6\u6216\u767e\u5206\u6bd4\uff0c\u6216\u8005\u662f\u5173\u952e\u5b57\u503cleft, right<\/strong>\u548c center <\/strong>\u3002\u7b2c\u4e8c\u4e2a\u503c\u5fc5\u987b\u662f\u957f\u5ea6\u6216\u767e\u5206\u6bd4\uff0c\u6216\u8005\u662fcenter, top<\/strong>\u548cbottom<\/strong>\u4e4b\u4e00\u7684\u5173\u952e\u5b57\u503c\u3002<\/span>
\n\u5f53\u6211\u4eec\u6307\u5b9a\u4e09\u4e2a\u503c\u65f6\uff0c\u524d\u4e24\u4e2a\u503c\u4e0e\u4e8c\u503c\u8bed\u6cd5\u76f8\u540c\uff0c\u4f46\u662f\u7b2c\u4e09\u4e2a\u503c\u8868\u793az\u504f\u79fb\uff0c\u56e0\u6b64\u5b83\u5fc5\u987b\u662f\u957f\u5ea6\u3002<\/span> <\/p>\n
\n 50\uff0550\uff05<\/strong>\uff0c\u5b83\u8868\u793a\u5143\u7d20\u7684\u4e2d\u5fc3\u3002\n<\/div>\n\u8bed\u6cd5<\/h3>\n
transform-origin: x-axis y-axis z-axis | initial | inherit;
<\/span><\/code><\/pre>\n<\/div>\n\n\n
\n \u503c<\/td>\n \u8bf4\u660e<\/td>\n<\/tr>\n \n x-axis<\/strong> <\/td>\n \u5b83\u4ee3\u8868\u6c34\u5e73\u4f4d\u7f6e\u3002\u8be5\u503c\u6307\u5b9a\u89c6\u56fe\u5728x\u8f74\u4e0a\u7684\u4f4d\u7f6e\u3002\u5176\u53ef\u80fd\u7684\u503c\u4e3a\u957f\u5ea6\uff0c\u767e\u5206\u6bd4\uff0cleft\u3001right<\/strong>\u548ccenter<\/strong>\u3002<\/td>\n<\/tr>\n \n y-axis<\/strong> <\/td>\n \u5b83\u4ee3\u8868\u5782\u76f4\u4f4d\u7f6e\u3002\u6b64\u503c\u6307\u5b9a\u89c6\u56fe\u5728y\u8f74\u4e0a\u7684\u4f4d\u7f6e\u3002\u5176\u53ef\u80fd\u7684\u503c\u4e3alength, percentage, top, bottom<\/strong>\u548ccenter<\/strong>\u3002<\/td>\n<\/tr>\n \n z-axis<\/strong> <\/td>\n \u6b64\u503c\u4e0e3D\u8f6c\u6362\u4e00\u8d77\u4f7f\u7528\u3002\u6b64\u503c\u6307\u5b9a\u89c6\u56fe\u5728z\u8f74\u4e0a\u7684\u4f4d\u7f6e\u3002\u53ef\u4ee5\u4f7f\u7528 length <\/strong>\u503c\u8fdb\u884c\u5b9a\u4e49\u3002\u4e0d\u5141\u8bb8\u4f7f\u7528\u767e\u5206\u6bd4\u503c\u3002<\/td>\n<\/tr>\n \n initial<\/strong> <\/td>\n \u5b83\u5c06\u5c5e\u6027\u8bbe\u7f6e\u4e3a\u5176\u9ed8\u8ba4\u503c\u3002<\/td>\n<\/tr>\n \n inherit<\/strong> <\/td>\n \u5b83\u4ece\u5176\u7236\u5143\u7d20\u7ee7\u627f\u5c5e\u6027\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u793a\u4f8b<\/h3>\n
\n transform-origin <\/strong>\u5c5e\u6027\u4ee5\u53ca\u957f\u5ea6\u548c\u767e\u5206\u6bd4\u503c\u3002\u4e24\u4e2a\u5143\u4ef6\u7684\u65cb\u8f6c\u89d2\u5ea6\u5747\u4e3a45\u5ea6\u3002\u8fd9\u91cc\uff0c\u662f\u5143\u7d20\u76842D\u8f6c\u6362\u3002\n<\/div>\n <!DOCTYPE html>
<html>
<head>
<style>
div{
height: 100px;
width: 400px;
border: 5px dotted violet;
font-size: 20px;
}
.outer {
margin: 100px;
background-color: cyan;
}
.box {
background: url( \"diamond.png\");
transform: rotate(35deg);
transform-origin: 5% 2%;
}
.outer1{
margin-left: 500px;
background-color: cyan;
}
.box1 {
background: url( \"diamond.png\");
transform: rotate(45deg);
transform-origin: 5% 2%;
}
<\/style>
<\/head>
<body>
<h1> Example of the CSS transform-origin Property <\/h1>
<div class=\"outer\"> transform-origin: 5% 2%;
<div class=\"box\"><\/div>
<\/div>
<div class=\"outer1\"> transform-origin: 100px 200px;
<div class=\"box1\"><\/div>
<\/div>
<\/body>
<\/html>
<\/span><\/code><\/pre>\n<\/div>\n <\/p>\n
\u793a\u4f8b<\/h3>\n
\n transform-origin <\/strong>\u5c5e\u6027\u548c\u5173\u952e\u5b57\u503c\u3002\n<\/div>\n <!DOCTYPE html>
<html>
<head>
<style>
div{
height: 100px;
width: 400px;
border: 5px dotted violet;
font-size: 20px;
}
.outer {
margin: 100px;
background-color: cyan;
}
.box {
background: url( \"diamond.png\");
transform: rotate(35deg);
transform-origin: left bottom;
}
.outer1{
margin-left: 500px;
background-color: cyan;
}
.box1 {
background: url( \"diamond.png\");
transform: rotate(45deg);
transform-origin: right top;
}
<\/style>
<\/head>
<body>
<h1> Example of the CSS transform-origin Property <\/h1>
<div class=\"outer\"> transform-origin: left bottom;
<div class=\"box\"><\/div>
<\/div>
<div class=\"outer1\"> transform-origin: right top;
<div class=\"box1\"><\/div>
<\/div>
<\/body>
<\/html>
<\/span><\/code><\/pre>\n<\/div>\n <\/p>\n
\n transform-origin <\/strong>\u5c5e\u6027\u3002\n<\/div>\n\u793a\u4f8b<\/h3>\n
\n transform-origin <\/strong>\u5c5e\u6027\u3002\n<\/div>\n <!DOCTYPE html>
<html>
<head>
<style>
div{
height: 100px;
width: 400px;
border: 5px dotted violet;
font-size: 20px;
}
.outer {
margin: 100px;
background-color: cyan;
text-align: center;
}
.box {
background: url( \"diamond.png\");
transform: rotate3d(3, 2, 1, 75deg);
transform-origin: 70% 10% 150px;
}
.outer1{
margin-left: 500px;
background-color: cyan;
text-align: center;
}
.box1 {
background: url( \"diamond.png\");
transform: rotate3d(2, 2, 1, 75deg);
transform-origin: bottom right 200px;
}
<\/style>
<\/head>
<body>
<h1> Example of the CSS transform-origin Property <\/h1>
<div class=\"outer\"> transform-origin: 70% 10% 150px;
<div class=\"box\"><\/div>
<\/div>
<div class=\"outer1\"> transform-origin: bottom right 200px;
<div class=\"box1\"><\/div>
<\/div>
<\/body>
<\/html>
<\/span><\/code><\/pre>\n<\/div>\n<\/p>\n","protected":false},"excerpt":{"rendered":"CSS transform-originzh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[175],"tags":[],"class_list":["post-2433","post","type-post","status-publish","format-standard","hentry","category-css-jc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/2433"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=2433"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/2433\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=2433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=2433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=2433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}