スタイルverticalAlignプロパティ
例
テーブル内の一部のテキストの垂直方向の配置を「下」に設定します。
document.getElementById("myTd").style.verticalAlign = "bottom";
定義と使用法
verticalAlignプロパティは、要素内のコンテンツの垂直方向の配置を設定または返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
verticalAlign | Yes | Yes | Yes | Yes | Yes |
構文
verticalAlignプロパティを返します。
object.style.verticalAlign
verticalAlignプロパティを設定します。
object.style.verticalAlign = value
プロパティ値
Value | Description |
---|---|
length | Raises or lower an element by the specified length. Negative values are allowed |
% | Raises or lower an element in a percent of the "line-height" property. Negative values are allowed |
baseline | Align the baseline of the element with the baseline of the parent element. This is default |
sub | Aligns the element as it was subscript |
super | Aligns the element as it was superscript |
top | The top of the element is aligned with the top of the tallest element on the line |
text-top | The top of the element is aligned with the top of the parent element's font |
middle | The element is placed in the middle of the parent element |
bottom | The bottom of the element is aligned with the lowest element on the line |
text-bottom | The bottom of the element is aligned with the bottom of the parent element's font |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | ベースライン |
---|---|
戻り値: | 要素内のコンテンツの垂直方向の配置を表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
<td>要素の垂直方向の配置を返します。
alert(document.getElementById("myTd").style.verticalAlign);
関連ページ
CSSチュートリアル:CSSテキスト
CSSリファレンス:vertical-alignプロパティ
❮スタイルオブジェクト