HTML - <multicol> 标签



HTML 的 <multicol> 标签用于创建多列文本,并允许您控制列的大小和数量。

<multicol> 标签可以包含任何其他 HTML 内容,就像 <div> 标签一样。<multicol> 标签内的所有内容都像常规内容一样显示,只是 Netscape 4 会将内容放置在多列中,而不是单列。

此标签不再推荐使用,因为它已弃用且在 HTML5 中不受支持,仅 Netscape 3 支持。

示例

以下示例将在 Netscape 中创建三列布局。

<h1>Breaking News</h1>
<multicol cols = 3>
   <p>State media said more than 2,000 soldiers, police and miners 
   closed the breach in the dike in Shandong province early Sunday and 
   installed pipes and five high-speed pumps, but gave no indication if 
   there were any signs of life.</p>
   
   <p>The Huayuan Mining Co. mine flooded on Friday afternoon when the 
   Wen river burst a dike, sending water pouring into a shaft and trapping 
   172 miners, Xinhua and state television said.</p>
</multicol>

运行以上代码后,它将生成一个输出,其中包含显示在网页上的文本。

属性

属性 描述
cols 数字 指定文本显示的文本列数。浏览器尝试将元素均匀地分布在各列中,以使每列的高度大致相同。除非存在 WIDTH 属性,否则列宽将调整为填充可用宽度。
gutter 数字 以像素为单位指定每列之间的距离。
width 数字 以像素为单位指定每列的宽度。所有列的宽度都相同。如果此属性不存在,则其值将根据列间距和列数计算得出。

标准属性

序号 属性 & 描述
1 class

文档范围标识符

2 dir

指定文本方向

3 id

文档范围标识符

4 style

帮助包含内联样式表。

5 lang

设置语言代码。

6 xml:lang

设置语言代码。

广告