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 max-height


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

Ví dụ

<!DOCTYPE html> <html>    <head>       <style>          div {             width: 350px;             background-color: orange;             overflow: auto;             border: 1px solid black;             animation: myanim 3s infinite;          }          @keyframes myanim {             30% {                max-height: 100px;             }          }       </style>    </head>    <body>       <h1>Example of max-height</h1>       <div>          <p>This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.             This is demo text. This is demo text. This is demo text.          </p>       </div>    </body> </html>