スタイルfontStyleプロパティ
例
要素のフォントを「イタリック」に設定します。
document.getElementById("demo").style.fontStyle = "italic";
定義と使用法
fontStyleプロパティは、フォントのスタイルが通常、斜体、斜体のいずれであるかを設定または返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
fontStyle | Yes | Yes | Yes | Yes | Yes |
構文
fontStyleプロパティを返します。
object.style.fontStyle
fontStyleプロパティを設定します。
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
プロパティ値
Value | Description |
---|---|
normal | Font is normal. This is default |
italic | Font is in italic |
oblique | Font is in oblique |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | 正常 |
---|---|
戻り値: | 要素内のテキストのフォントスタイルを表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
可能な値のデモンストレーション:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontStyle = listValue;
例
要素のフォントスタイルを返します。
alert(document.getElementById("demo").style.fontStyle);
関連ページ
CSSチュートリアル:CSSフォント
CSSリファレンス:font-styleプロパティ
HTML DOMリファレンス:フォントプロパティ
❮スタイルオブジェクト