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

Cách cân bằng nội dung cột với CSS column-fill

Để cân bằng nội dung giữa các cột, sử dụng thuộc tính column-fill. Bạn có thể chạy đoạn mã sau để triển khai thuộc tính column-fill với giá trị balance:

Ví dụ

<!DOCTYPE html> <html>    <head>       <style>          .demo {             column-count: 4;             column-fill: balance;          }       </style>    </head>    <body>       <div class = "demo">          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.          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.       </div>    </body> </html>