What CSS selector can be used to select the first div within another div(什么 CSS 选择器可以用来选择另一个 div 中的第一个 div)
问题描述
我有类似的东西:
<div id="content><h1>欢迎来到汽车城熟食店!</h1><div style="font-size: 1.2em; font-weight: bolder;">2010 年 9 月 19 日</div>... </div>第二个 div(内容"div 中的第一个 div)的 css 选择器是什么,以便我可以在该 div 中设置日期的字体颜色?
解决方案 您的问题最正确的答案是......
#content >div:first-of-type {/* css *