Home  >  Article  >  Web Front-end  >  What is the use of column-span in css3

What is the use of column-span in css3

青灯夜游
青灯夜游Original
2021-07-07 16:17:362938browse

In CSS3, the column-span attribute is used to specify how many columns an element should span when the elements are displayed in columns; the syntax format is "column-span:1|all;", when the value is "1 " specifies that the element should span one column, and "all" specifies that the element should span all columns.

What is the use of column-span in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

The column-span attribute can specify how many columns an element should span. Syntax format:

column-span: 1|all;
##ValueDescription1The element should span one column allThis element should span all columns
Let’s take a look at the column-span attribute through an example Function:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<style> 
.div1,.div2
{
	column-count:3;
	-moz-column-count:3; /* Firefox */
	-webkit-column-count:3; /* Safari and Chrome */

}
.div1 h2
{
	column-span:2;
	-webkit-column-span:2; /* Safari and Chrome */
}
.div2 h2
{
	column-span:all;
	-webkit-column-span:all; /* Safari and Chrome */
}
</style>
</head>
<body>



<div class="div1">
<h2>英国维斯米斯特教堂碑文</h2>
当我年轻的时候,我梦想改变这个世界;当我成熟以后,我发现我不能够改变这个世界,我将目光缩短了些,决定只改变我的国家;当我进入暮年以后,我发现我不能够改变我们的国家,我的最后愿望仅仅是改变一下我的家庭,但是,这也不可能。当我现在躺在床上,行将就木时,我突然意识到:如果一开始我仅仅去改变我自己,然后,我可能改变我的家庭;在家人的帮助和鼓励下,我可能为国家做一些事情;然后,谁知道呢?我甚至可能改变这个世界。
</div>
<div class="div2">
<h2>英国维斯米斯特教堂碑文</h2>
当我年轻的时候,我梦想改变这个世界;当我成熟以后,我发现我不能够改变这个世界,我将目光缩短了些,决定只改变我的国家;当我进入暮年以后,我发现我不能够改变我们的国家,我的最后愿望仅仅是改变一下我的家庭,但是,这也不可能。当我现在躺在床上,行将就木时,我突然意识到:如果一开始我仅仅去改变我自己,然后,我可能改变我的家庭;在家人的帮助和鼓励下,我可能为国家做一些事情;然后,谁知道呢?我甚至可能改变这个世界。
</div>
</body>
</html>

Rendering:


What is the use of column-span in css3

(Learning video sharing:

css video tutorial)

The above is the detailed content of What is the use of column-span in css3. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn