トップページ  > CSS  > text-align-last

★CSSリファレンス

text-align-last …… ブロックコンテナ内の最後の行の揃え位置・均等割付を指定する
Internet Explorer Google Chrome Safari Firefox Opera
広告

text-align-lastプロパティは、ブロックコンテナ内の最後の行の揃え位置・均等割付を指定する際に使用します。

最後の行のほかに、強制改行の直前の行や強制改行の直後の1行目についても、text-align-lastプロパティの指定が優先されます。

text-alignプロパティの値が justify-all 以外の場合、text-align-lastプロパティの値は auto に設定されます。

■値

auto
自動算出される(初期値)
start
インラインレベルのコンテンツは、ラインボックスの始端に揃えられる
end
インラインレベルのコンテンツは、ラインボックスの終端に揃えられる
left
インラインレベルのコンテンツは、ラインボックスの左端に揃えられる(縦書きモードではtext-orientationプロパティで指定するテキストの方向次第で上端または下端のいずれかに揃えられる)
right
インラインレベルのコンテンツは、ラインボックスの右端に揃えられる(縦書きモードではtext-orientationプロパティで指定するテキストの方向次第で上端または下端のいずれかに揃えられる)
center
インラインレベルのコンテンツは、ラインボックスの中央に配置される
justify
均等割付。最後の行についてはtext-align-last-lastプロパティの指定がない限り、ラインボックスの始端に揃えられる

■初期値・適用対象・値の継承

初期値
auto
適用対象
ブロックコンテナ
値の継承
する

■使用例

スタイルシート部分は外部ファイル(sample.css)に記述。

p.sample {
	width:300px;
	background-color:#99cc00;
	text-align:start;
}

HTMLソース

<p class="sample" style="text-align-last:auto;">
text-align:start;<br>
text-align-last:auto;<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:start;">
text-align:start;<br>
text-align-last:start<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:end;">
text-align:start;<br>
text-align-last:end<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:left;">
text-align:start;<br>
text-align-last:left<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:right;">
text-align:start;<br>
text-align-last:right<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:center;">
text-align:start;<br>
text-align-last:center<br>
を指定<br>
How inline content is distributed within a line box?
</p>
<p class="sample" style="text-align-last:justify;">
text-align:start;<br>
text-align-last:justify<br>
を指定<br>
How inline content is distributed within a line box?
</p>
↓↓↓

ブラウザ上の表示

text-align:start;
text-align-last:auto;
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:start
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:end
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:left
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:right
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:center
を指定
How inline content is distributed within a line box?

text-align:start;
text-align-last:justify
を指定
How inline content is distributed within a line box?

広告
Sponsors
広告
MuuMuu Domain!
ドメイン取るならお名前.com
現役エンジニアのオンライン家庭教師【CodeCamp】
サイトに広告を掲載してお小遣いが稼げる!【A8.net】
Node.jsコース
はじめてのプログラミングコース
▲ページ先頭へ
HTMLクイックリファレンスについて
© HTMQ