สไตล์minคุณสมบัติ ความกว้าง
ตัวอย่าง
กำหนดความกว้างขั้นต่ำของ <div> องค์ประกอบ:
document.getElementById("myDIV").style.minWidth = "400px";
ความหมายและการใช้งาน
คุณสมบัติ minWidth ตั้งค่าหรือส่งคืนความกว้างขั้นต่ำขององค์ประกอบ
คุณสมบัติ minWidth มีผลเฉพาะกับองค์ประกอบระดับบล็อกหรือองค์ประกอบที่มีตำแหน่งที่แน่นอนหรือคงที่
เคล็ดลับ:หากต้องการตั้งค่าหรือคืนค่าความกว้างสูงสุดขององค์ประกอบ ให้ใช้คุณสมบัติmaxWidth
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
minWidth | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ minWidth:
object.style.minWidth
ตั้งค่าคุณสมบัติ minWidth:
object.style.minWidth = "length|%|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
length | Defines the minimum width in length units. Default is 0 |
% | Defines the minimum width in % of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | 0 |
---|---|
คืนมูลค่า: | สตริง แทนความกว้างขั้นต่ำขององค์ประกอบ |
เวอร์ชัน CSS | CSS2 |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ส่งกลับความกว้างขั้นต่ำของ <p> องค์ประกอบ:
alert(document.getElementById("myP").style.minWidth);
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Dimension
การอ้างอิง CSS: คุณสมบัติความกว้างขั้นต่ำ
❮ สไตล์วัตถุ