支援CSS3 以上 用法::last-child 說明: a tag 是最後一個子元素 css定義:      a tag是最後一個子元素  套用樣式 a:last-child { font-size: 20px; 字型20像素 color: red;  字顏色red background-color: yellow; 背景色 yellow } 注意事項:  a tag 是最後一個子元素,  如果在div裡面的最後一個子元素,也算喔~ 程式: <!DOCTYPE html> <html> <head> <title>css3 Selector last-child 套用樣式</title> <meta http-equiv="Content-Type" content="text/html; charset=BIG5"> <style type="text/css"> a:last-child { font-size: 20px; color: red; background-color: yellow; } </style> </head> <body> <a href="#1">a tag test 1</a> <div> <a href="#2">a tag test 2</a> <a href="#3">a tag test 3</a> </div> <a href="#4">a tag test 4</a> </body> </html> 會有二個tag被套用~ a3及a4 圖1:

測試結束~ 如果還不了解可參考:w3schools CSS Selector Reference 感謝~

 

 

 

其它文章

文章標籤
全站熱搜
創作者介紹
創作者 PG Levin Li 的頭像
PG Levin Li

程式開發學習之路

PG Levin Li 發表在 痞客邦 留言(0) 人氣(87)