CSS :last-of-type Selector
例
親の最後の<p>要素の背景色を指定します。
p:last-of-type
{
background: #ff0000;
}
定義と使用法
:last-of-type
セレクターは、特定のタイプの親の最後の子であるすべての要素に一致します。
ヒント:これは:nth-last-of-type(1)と同じです。
バージョン: | CSS3 |
---|
ブラウザのサポート
表の数字は、セレクターを完全にサポートする最初のブラウザーのバージョンを示しています。
Selector | |||||
---|---|---|---|---|---|
:last-of-type | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
CSS構文
:last-of-type {
css declarations;
}