HTMLFontElement: thuộc tính size

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Thuộc tính đã lỗi thời HTMLFontElement.size là một chuỗi phản ánh thuộc tính HTML size. Nó chứa kích thước font chữ từ 1 đến 7 hoặc một số tương đối so với giá trị mặc định 3, ví dụ -2 hoặc +1.

Định dạng của chuỗi phải tuân theo một trong các microsyntax HTML sau:

Microsyntax Mô tả Ví dụ
Chuỗi số kích thước hợp lệ số nguyên trong khoảng 1-7 6
Chuỗi kích thước tương đối +x hoặc -x, trong đó x là số tương đối so với 3 (kết quả phải nằm trong khoảng 1-7) +2
-1

Giá trị

Một chuỗi.

Ví dụ

js
// Giả sử có phần tử <font id="f"> trong HTML

const f = document.getElementById("f");
f.size = "6";

Thông số kỹ thuật

Thông số kỹ thuật
HTML
# dom-font-size

Tương thích trình duyệt

Xem thêm