Phương thức String.prototype.fontsize(size) bọc chuỗi trong thẻ <font size="size">. Deprecated (thẻ <font> đã bị loại khỏi HTML5).
Ví dụ (tham khảo)
<!DOCTYPE html>
<html>
<body>
<script>
var str = "Văn bản to";
document.write(str.fontsize(7)); // "Văn bản to"
</script>
</body>
</html>
Cách chuẩn (CSS):
<!-- Inline style --> Văn bản 24px <!-- CSS class --> Văn bản lớn // JS set style element.style.fontSize = '24px';
Thẻ <font> đã deprecated từ HTML4. Luôn dùng CSS font-size (px, rem, em, %).