Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Tạo hiệu ứng chuyển động cho thuộc tính CSS left


Để thực hiện animation trên thuộc tính left với CSS, bạn có thể chạy đoạn mã sau:

Ví dụ

<!DOCTYPE html> <html>    <head>       <style>          div {             border: 2px solid black;             width: 300px;             height: 100px;             position: absolute;             left: 0;             animation: myanim 5s infinite;          }          @keyframes myanim {             30% {                left: 200px;             }          }       </style>    </head>    <body>       <div>This is demo text</div>    </body> </html>