คุณสมบัติคอลัมน์ช่องว่าง CSS
ตัวอย่าง
ระบุช่องว่าง 40 พิกเซลระหว่างคอลัมน์:
div
{
column-gap: 40px;
}
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
คุณสมบัติcolumn-gap
ระบุช่องว่างระหว่างคอลัมน์
หมายเหตุ:หากมีคอลัมน์-กฎระหว่างคอลัมน์ กฎนั้นจะปรากฏตรงกลางช่องว่าง
ค่าเริ่มต้น: | ปกติ |
---|---|
รับการถ่ายทอด: | ไม่ |
เคลื่อนไหวได้: | ใช่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS Box Alignment Module ระดับ 3 |
ไวยากรณ์ JavaScript: | วัตถุ .style.columnGap="50px" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
column-gap (in Multiple Columns) | 50 | 10 | 52 | 10 | 37 |
column-gap (in Grid) | 66 | 16 | 61 | 12.1 | 53 |
column-gap (in Flexbox) | 84 | 84 | 63 | Not supported | 70 |
ไวยากรณ์ CSS
column-gap: length|normal|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
length | A specified length that will set the gap between the columns | |
normal | Default value. Specifies a normal gap between the columns. W3C suggests a value of 1em | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
แบ่งข้อความใน <div> องค์ประกอบออกเป็นสามคอลัมน์:
div
{
column-count: 3;
}
ตัวอย่าง
ระบุความกว้าง ลักษณะ และสีของกฎระหว่างคอลัมน์:
div
{
column-rule: 4px double #ff00ff;
}
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS หลายคอลัมน์
กวดวิชา CSS: CSS Grid Layout
การอ้างอิง CSS: คุณสมบัติrow -gap
การอ้างอิง CSS: คุณสมบัติช่องว่าง
การอ้างอิง HTML DOM: คุณสมบัติ columnGap