สไตล์ล้นคุณสมบัติ
ตัวอย่าง
ใช้คุณสมบัติล้นเพื่อเลื่อนเนื้อหาที่ล้น:
document.getElementById("myDIV").style.overflow = "scroll";
ความหมายและการใช้งาน
ชุดคุณสมบัติล้นหรือส่งคืนสิ่งที่ต้องทำกับเนื้อหาที่แสดงนอกกล่ององค์ประกอบ
เคล็ดลับ:หากคุณต้องการซ่อนแถบเลื่อนของทั้งเอกสาร ให้ใช้คุณสมบัติล้นบนเนื้อหาหรือองค์ประกอบ html
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
overflow | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติล้น:
object.style.overflow
ตั้งค่าคุณสมบัติล้น:
object.style.overflow = "visible|hidden|scroll|auto|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
visible | Content is NOT clipped and may be shown outside the element box. This is default |
hidden | Content outside the element box is not shown |
scroll | Scroll bars are added, and content is clipped when necessary |
auto | Content is clipped and scroll bars are added when necessary |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | มองเห็นได้ |
---|---|
คืนมูลค่า: | สตริงที่แสดงถึงเนื้อหาที่แสดงผลนอกกล่ององค์ประกอบ |
เวอร์ชัน CSS | CSS2 |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ใช้คุณสมบัติล้นเพื่อซ่อนเนื้อหาที่ล้น:
document.getElementById("myDiv").style.overflow = "hidden";
ตัวอย่าง
ส่งคืนคุณสมบัติล้น:
alert(document.getElementById("myDiv").style.overflow);
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS ล้น
กวดวิชา CSS: การจัดตำแหน่ง CSS
การอ้างอิง CSS: คุณสมบัติล้น
❮ สไตล์วัตถุ