HTMLDOMスタイルのfontStyleプロパティ
HTML DOMスタイルのfontStyleプロパティは、テキストのフォントスタイルを設定または返すために使用されます。要素のテキストの通常、斜体、または斜体のスタイルを指定するために使用されます。
以下は、-
の構文です。fontStyleプロパティの設定-
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
fontStyleプロパティの例を見てみましょう-
例
<!DOCTYPE html>
<html>
<head>
<style>
#demo2,#demo1 {
font-family: 'times new roman';
font-size: 25px;
}
</style>
<script>
function changeFontStyle() {
document.getElementById("demo1").style.fontStyle="italic";
document.getElementById("demo2").style.fontStyle="italic";
document.getElementById("Sample").innerHTML="The font style has been changed for the above paragraphs.";
}
</script>
</head>
<body>
<div id="demo1" >This is demo text 1</div>
<div id="demo2">This is demo text 2</div>
<p>Change the above divs font style by clicking the below button</p>
<button onclick="changeFontStyle()">Change fontStyle </button>
<p id="Sample"></p>
</body>
</html> 出力
「fontStyleの変更」をクリックすると 」ボタン-
-
HTMLDOMスタイルtransformOriginプロパティ
HTML DOMスタイルのtransformOriginプロパティは、2Dまたは3D変換を返し、HTMLドキュメントの要素に適用します。 構文 以下は構文です- transformOriginを返す object.style.transformOrigin transformOriginの変更 object.style.transformOrigin = “value” 値 ここで、値は-になります。 値 説明 継承 このプロパティ値は親要素から継承されます。 初期 このプロパティ値をデフォルト値に設定します。 x軸y軸z軸 ビュー
-
HTMLDOMスタイルのfontStyleプロパティ
HTML DOMスタイルのfontStyleプロパティは、テキストのフォントスタイルを設定または返すために使用されます。要素のテキストの通常、斜体、または斜体のスタイルを指定するために使用されます。 以下は、-の構文です。 fontStyleプロパティの設定- object.style.fontStyle = "normal|italic|oblique|initial|inherit" fontStyleプロパティの例を見てみましょう- 例 <!DOCTYPE html> <html> <head> <style> &