1. 程式人生 > >CSS選擇器 漸變背景

CSS選擇器 漸變背景

css選取p:first-child選擇屬於其父元素的首個子元素的每個 <p> 元素,span:nth-child(2)  選擇第2個spanli:first-child   選擇列表中的第一個 <li> 元素並設定其樣式:ul>:first-child   設定每個 <ul> 的首個子元素,並設定其樣式:p:first-child i 選擇每個 <p> 中的每個 <i> 元素並設定其樣式,其中的 <p> 元素是其父元素的第一個子元素 #Ulist li:nth-of-type(odd){ margin-left: 20px;}奇數行  #Ulist li:nth-of-type(even){margin-left: 10px;}偶數行