สไตล์ไลน์คุณสมบัติ ความสูง
ตัวอย่าง
กำหนดความสูงของเส้นสำหรับ <div> องค์ประกอบ:
document.getElementById("myDiv").style.lineHeight = "3";
ความหมายและการใช้งาน
คุณสมบัติ lineHeight ตั้งค่าหรือส่งคืนระยะห่างระหว่างบรรทัดในข้อความ
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
ส่งคืนคุณสมบัติ lineHeight:
object.style.lineHeight
ตั้งค่าคุณสมบัติ lineHeight:
object.style.lineHeight = "normal|number|length|%|initial|inherit"
มูลค่าทรัพย์สิน
Value | Description |
---|---|
normal | Normal line height is used. This is default |
number | A number that will be multiplied with the current font size to set the line height |
length | Defines the line height in length units |
% | Defines the line height in % of the current font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | ปกติ |
---|---|
คืนมูลค่า: | สตริง แทนระยะห่างระหว่างบรรทัดในข้อความ |
เวอร์ชัน CSS | CSS1 |
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ส่งกลับความสูงของเส้น <div> องค์ประกอบ:
alert(document.getElementById("myDiv").style.lineHeight);
หน้าที่เกี่ยวข้อง
กวดวิชา CSS: CSS Text
การอ้างอิง CSS: คุณสมบัติความสูงของบรรทัด
❮ สไตล์วัตถุ