Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS를 사용하여 변환된 요소의 위치 변경

<시간/>

CSS로 변형된 요소의 위치를 ​​변경하려면 transform-origin을 사용하세요. 재산.

다음 코드를 실행하여 위치를 변경할 수 있습니다.

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         .demo1 {
            width: 300px;
            height: 300px;
            background-color: yellow;
         }
         .demo2 {
            width: 200px;
            height: 200px;
            background-color: orange;
         }
         .demo3 {
            width: 100px;
            height: 100px;
            background-color: blue;
            transform: rotate(10deg);
            transform-origin: 30% 40%;
         }
      </style>
   </head>
   <body>
      <h1>Rotation</h1>
      <div class = "demo1">Demo
         <div class = "demo2">Demo
            <div class = "demo3">
               Demo
            </div>
         </div>
      </div>
   </body>
</html>