我的前端学习经验(8)
前端学习经验(8) CSS 结构伪类选择器 type系列: first-of-type:选择同类型的标签或选择器中第一个元素。 父元素>标签或选择器:first-of-type{ 样式表 } 如: <head> <style> .a>div:first-of-type{ font-family: "楷体"; font-size: 30px; color: aqua; } .a>.aa:first-of-type{ font-family: "黑体"; font-size: 50px; color: green; } </style> </head> <body> <div class="a"> <h3>子元素1</h3> <div>子元素2</div> <p>子元素3</p> <span class="aa">子元素4</span> <h3>子元素5</h3> <h3 class="aa">子元素6</h3> <div>子元素7</div> <p>子元素8</p> <h3>子元素9</h3> <div>子元素10</div> <div class="aa">子元素11</div> <p>子元素12</p> </div> </body> first-of-type:选择同类型的标签或选择器中最后一个元素。 父元素>标签或选择器:last-of-type{ 样式表 } 如: <head