สไตล์whiteSpace Property
ตัวอย่าง
ระบุว่าข้อความใน <div> องค์ประกอบจะไม่ตัด:
document.getElementById("myDIV").style.whiteSpace = "nowrap";
ความหมายและการใช้งาน
คุณสมบัติ whiteSpace ตั้งค่าหรือส่งคืนวิธีจัดการกับแท็บ ตัวแบ่งบรรทัด และช่องว่างในข้อความ
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
whiteSpace | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ whiteSpace:
object.style.whiteSpace
ตั้งค่าคุณสมบัติ whiteSpace:
object.style.whiteSpace = "normal|nowrap|pre|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
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 | CSS1 |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
คืนคุณสมบัติ whiteSpace
alert(document.getElementById("myDiv").style.whiteSpace);
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Text
การอ้างอิง CSS: คุณสมบัติช่องว่างสีขาว
❮ สไตล์วัตถุ