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

Chỉ định số lượng cột cho phần tử với CSS column-count

Để chỉ định số lượng cột mà một phần tử nên được chia thành, sử dụng thuộc tính column-count.

Bạn có thể chạy đoạn mã sau để triển khai thuộc tính column-count với 4 cột:

Ví dụ

<!DOCTYPE html> <html>    <head>       <style>          .demo {             column-count: 4;          }       </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. This is demo text. This is demo text.          This is demo text.       </div>    </body> </html>