在本文中,我们将学习在 CSS 中为列指定最佳宽度。这 CSS 的 column-width属性用于指定列的最佳宽度。
方法:我们可以使用 column-width属性为 CSS 中的列指定最佳宽度。我们为列宽设置一个值,所有列的宽度不小于指定值。
句法:
column-width: value;
示例 1: 下列的 示例演示了设置column-width属性。输出结果为内容的四列。
HTML
GeeksforGeeks is my favourite site where
i can gain a lot of knowledge and can
also share my knowledge what i have gained
while learning. We can add more
pharagraphs for content. This is just an
example to tell you how to specify
the optimal width for the columns in CSS?
The column width is 160px in this example.
HTML
GeeksforGeeks is my favourite site where
i can gain a lot of knowledge and can
also share my knowledge what i have
gained while learning. We can add more
pharagraphs for content. This is just
an example to tell you how to specify
the optimal width for the columns in CSS?
The column width is 160px in this example.
输出:
示例 2:以下示例演示了为文本内容设置列数和列宽等属性。
HTML
GeeksforGeeks is my favourite site where
i can gain a lot of knowledge and can
also share my knowledge what i have
gained while learning. We can add more
pharagraphs for content. This is just
an example to tell you how to specify
the optimal width for the columns in CSS?
The column width is 160px in this example.
输出: