CSS - column-span 属性



CSS 属性 column-span 确定一个元素可以跨越多少列。

跨元素是跨多列的元素。

可能的值

CSS 属性 column-span 采用以下值之一:

  • none:元素不跨越多列。
  • all:元素跨所有列。

适用于

所有流入的块级元素。

语法


column-span = none | all

CSS column-span - 所有值

在以下示例中,标题设置为跨越文章的所有列:


<html>
<head>
<style>	
	 	.multicol-col-rule {
	 	 	 column-count: 3;
	 	 	 column-gap: 50px;
	 	 	 column-rule: 5px dashed red;
	 	}

	 	h1 {
	 	 	 column-span: all;
	 	 	 background-color: lightskyblue;
	 	}
</style>
</head>
<body>
	 	<p>As per the <strong>column-span</strong> property the element gets spanned across all the columns:</p>

	 	<div class="multicol-col-rule">
	 	 	 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
	 	 	 <h1>Heading spanning across all the columns</h1>
	 	 	 <p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.</p>
	 	</div>
</body>
</html>