Stil fontSize Özellik
Örnek
Bir öğenin yazı tipi boyutunu "x-large" olarak ayarlayın:
document.getElementById("demo").style.fontSize = "x-large";
Tanım ve Kullanım
fontSize özelliği, metnin yazı tipi boyutunu ayarlar veya döndürür.
Tarayıcı Desteği
Property | |||||
---|---|---|---|---|---|
fontSize | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
fontSize özelliğini döndürün:
object.style.fontSize
fontSize özelliğini ayarlayın:
object.style.fontSize = "value|initial|inherit"
Mülk değerleri
Value | Description |
---|---|
xx-small x-small small medium large x-large xx-large |
Sets the size of the font to different fixed sizes, from xx-small to xx-large |
smaller | Decreases the font-size by one relative unit |
larger | Increases the font-size by one relative unit |
length | Defines the font-size in length units |
% | Sets the font-size to a % of the parent element's font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Teknik detaylar
Varsayılan değer: | orta |
---|---|
Geri dönüş değeri: | Öğedeki metnin yazı tipi boyutunu temsil eden bir Dize |
CSS Sürümü | CSS1 |
Daha fazla örnek
Örnek
Olası değerlerin bir gösterimi:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontSize = listValue;
Örnek
Bir öğenin yazı tipi boyutunu döndür:
alert(document.getElementById("demo").style.fontSize);
İlgili Sayfalar
CSS eğitimi: CSS Yazı Tipi
CSS referansı: yazı tipi boyutu özelliği
HTML DOM referansı: yazı tipi özelliği
❮ Stil Nesnesi