CSSStyleDeclarationcssText プロパティ
例
H1要素のインラインスタイルの値を返します。
var elmnt = document.getElementsByTagName("h1")[0];
var x = elmnt.style.cssText;
定義と使用法
cssTextプロパティは、要素のインラインスタイル宣言の値を設定または返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
cssText | Yes | Yes | Yes | Yes | Yes |
構文
cssTextプロパティを返します。
element.style.cssText
cssTextプロパティを設定します。
element.style.cssText = style
技術的な詳細
DOMバージョン: | レベル2スタイルのCSS |
---|---|
戻り値: | 指定された要素のインラインスタイルを表す文字列 |
その他の例
例
要素のインラインスタイル宣言のテキストを設定します。
document.getElementById("ex1").style.cssText = "color: blue;";
❮CSSStyleDeclarationオブジェクト