CSS white-spaceคุณสมบัติ
ตัวอย่าง
แสดงให้เห็นถึงค่าต่างๆ ของคุณสมบัติ white-space:
p.a {
white-space: nowrap;
}
p.b {
white-space: normal;
}
p.c {
white-space:
pre;
}
ความหมายและการใช้งาน
คุณสมบัติwhite-space
ระบุวิธีจัดการพื้นที่สีขาวภายในองค์ประกอบ
ค่าเริ่มต้น: | ปกติ |
---|---|
รับการถ่ายทอด: | ใช่ |
เคลื่อนไหวได้: | ไม่. อ่านเกี่ยวกับแอนิเมชั่น |
รุ่น: | CSS1 |
ไวยากรณ์ JavaScript: | วัตถุ .style.whiteSpace="nowrap" |
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Property | |||||
---|---|---|---|---|---|
white-space | 1.0 | 8.0 | 3.5 | 3.0 | 9.5 |
ไวยากรณ์ CSS
white-space: normal|nowrap|pre|pre-line|pre-wrap|initial|inherit;
มูลค่าทรัพย์สิน
Value | Description | Play it |
---|---|---|
normal | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary. This is default | |
nowrap | Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered | |
pre | Whitespace is preserved by the browser. Text will only wrap on line breaks. Acts like the <pre> tag in HTML | |
pre-line | Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks | |
pre-wrap | Whitespace is preserved by the browser. Text will wrap when necessary, and on line breaks | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Text
การอ้างอิง HTML DOM: คุณสมบัติ whiteSpace