:last-child----represents the last element among a group of sibling elements.
CSS偽類 :last-child 代表在一群兄弟元素中的最后一個元素。
-
從代碼和圖可以看出:last-child選擇了最后一個li標簽。
同時,我們換另外一段代碼,看看是否還有這樣的效果。
-
-
從代碼和圖可以看出,:last-child並沒有起到我們想要的作用。如果,這個時候去掉最后的div標簽,再看看效果。
-
這時,效果出來了,那么,可以總結了。
:last-child表示其父元素的最后一個子元素,且這個元素是css指定的元素,才可以生效。
:last-of-type
-





