Thuộc tính dòng chiều cao
Ví dụ
Đặt chiều cao dòng cho phần tử <div>:
document.getElementById("myDiv").style.lineHeight = "3";
Hãy tự mình thử »Sự miêu tả
Thuộc tính lineHeight đặt hoặc trả về khoảng cách giữa các dòng trong văn bản.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
lineHeight | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả về thuộc tính lineHeight:
object .style.lineHeight
Đặt thuộc tính lineHeight:
object .style.lineHeight = "normal| number | length | % |initial|inherit"
Giá trị tài sản
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 |
Chi tiết kỹ thuật
Giá trị mặc định: | Bình thường |
---|---|
Giá trị trả về: | Một Chuỗi, biểu thị khoảng cách giữa các dòng trong văn bản |
Phiên bản CSS | CSS1 |
Thêm ví dụ
Ví dụ
Trả về chiều cao dòng của phần tử <div>:
alert(document.getElementById("myDiv").style.lineHeight);
Hãy tự mình thử »Trang liên quan
Hướng dẫn CSS: Văn bản CSS
Tham chiếu CSS: thuộc tính chiều cao dòng