請問 ul > li:first-child{ color: red; } 與 ul > li :first-child{ color: red; } (li與:first-child之間有空格)的差異
請問為什么 ul > li:first-child{ ?color: red; } 顯示 li 圓點為紅色,而 ul > li :first-child{ ?color: red; } (li與:first-child之間有空格)卻變成各 li 下的文字變成紅色呢?請問是因為空格代表后代選擇器嗎?
2015-10-09
li:first-child表示ul的第一個子元素;
li :first-child無效的選擇,選取為li