选择第一个子元素:first-child
li:first-child{text-decoration: underline;}li:last-child{color: red;}p:first-child{font-style: italic;}
<p>xiaoren</p><ul><li>Insert Key</li><li>Turn Key<strong>clockwise</strong></li><li>Push accelerator</li></ul><ul><li>这个也带下划线的 </li><li>这个红色字体 </li></ul><ul><li>下划线+红色字体 </li></ul><div><p>first-child 为某元素第一个子元素为P元素设置为<em>斜体</em></p><p>正常字体</p></div>