|
Author: Jenny Nguyen
|
|
The :last-child selector is used to select the specified selector, only if it is the last child of its parent. Example: - Select and style the last child element of every <ul> element: ul>:last-child { background:#000; } - Select and style the last <li> element in lists: li:last-child {background:#A40003;} - Select and style every <p> element that is the last child of its parent: p:last-child { background-color:#999;} The :last-child selector is supported only in Mozilla Firefox 4 browser. Did you like this tip Beside that, you can use :last-of-type selector to matches every element that is the last child of its parent. p:last-of-type { background:#000; }
|