要使用 CSS 设置多列文本布局,可以使用CSS的列属性(column)来实现。首先需要使用column-count属性来设置列数,例如:
.container {
column-count: 3;
}
这将把.container元素分成3个列。还可以使用column-width属性来设置每列的宽度,例如:
.container {
column-count: 3;
column-width: 200px;
}
这将把.container元素分成3个等宽的列,每列宽度为200像素。此外,还可以使用column-gap属性来设置列与列之间的间距,例如:
.container {
column-count: 3;
column-width: 200px;
column-gap: 20px;
}
这将把.container元素分成3个等宽的列,每列宽度为200像素,列与列之间的间距为20像素。
需要注意的是,CSS列属性并不是在所有浏览器中都得到完全支持,所以在使用时需要进行兼容性测试。