CSS3 - 多列

CSS3支持多列将文本排列为新闻纸结构.

一些最常用的多列属性如下所示 :

Sr.No.Value& ;说明
1

列数

用于计算元素应划分的列数.

2

列填充

用于决定如何填充列.

3

列间距

用于确定列之间的差距.

4

column-rule

用于指定规则数.

5

rule-color

用于指定列规则颜色.

6

规则样式

用于指定列的样式规则.

7

规则宽度

用于指定宽度.

8

column-span

用于指定列之间的范围.

示例

下面的示例显示了文本作为新纸张结构的排列.

<html>
   <head>
      <style>
         .multi {
            /* Column count property */
            -webkit-column-count: 4;
            -moz-column-count: 4;
            column-count: 4;
            
            /* Column gap property */
            -webkit-column-gap: 40px; 
            -moz-column-gap: 40px; 
            column-gap: 40px;
            
            /* Column style property */
            -webkit-column-rule-style: solid; 
            -moz-column-rule-style: solid; 
            column-rule-style: solid;
         }
      </style>
   </head>

   <body>
   
      <div class = "multi">
         Tutorials Point originated from the idea that there exists a class 
         of readers who respond better to online content and prefer to learn 
         new skills at their own pace from the comforts of their drawing rooms.
         The journey commenced with a single tutorial on HTML in 2006 and elated 
         by the response it generated, we worked our way to adding fresh tutorials
         to our repository which now proudly flaunts a wealth of tutorials and 
         allied articles on topics ranging from programming languages to web 
         designing to academics and much more.
      </div>
      
   </body>
</html>

假设,如果用户想要将文本作为没有行的新论文,我们可以通过删除样式语法来实现,如下所示:

.multi {
   /* Column count property */
   -webkit-column-count: 4;
   -moz-column-count: 4;
   column-count: 4;
   
   /* Column gap property */
   -webkit-column-gap: 40px; 
   -moz-column-gap: 40px; 
   column-gap: 40px;
}