คุณสมบัติการนับคอลัมน์ CSS
ตัวอย่าง
แบ่งข้อความใน <div> องค์ประกอบออกเป็นสามคอลัมน์:
div
{
column-count: 3;
}
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติcolumn-count
ระบุจำนวนคอลัมน์ที่ควรแบ่งออกเป็นองค์ประกอบ
ค่าเริ่มต้น: | รถยนต์ |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ใช่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS3 |
ไวยากรณ์ JavaScript: | วัตถุ .style.columnCount = "3" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
ตัวเลขตามด้วย -webkit- หรือ -moz- ระบุเวอร์ชันแรกที่ทำงานกับคำนำหน้า
Property | |||||
---|---|---|---|---|---|
column-count | 50.0 4.0 -webkit- |
10.0 | 52.0 2.0 -moz- |
9.0 3.1 -webkit- |
37.0 15.0 -webkit 11.1 |
ไวยากรณ์ CSS
column-count: number|auto|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
number | The optimal number of columns into which the content of the element will be flowed | |
auto | Default value. The number of columns will be determined by other properties, like e.g. "column-width" | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ระบุช่องว่าง 40 พิกเซลระหว่างคอลัมน์:
div
{
column-gap: 40px;
}
ตัวอย่าง
ระบุความกว้าง ลักษณะ และสีของกฎระหว่างคอลัมน์:
div
{
column-rule: 4px double #ff00ff;
}
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS หลายคอลัมน์
การอ้างอิง HTML DOM: คุณสมบัติ columnCount