如何使用 CSS 指定元素应划分为多少列
要指定元素应划分为多少列,请使用 column-count 属性。
你可以尝试运行以下代码,用 4 列实现 column-count 属性
示例
<!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. </div> </body> </html>
广告