Match only the first descendent in pure css?

后端 未结 2 879
猫巷女王i
猫巷女王i 2021-01-29 01:04

Is there an elegant way in pure css to match only the first descendent -- similar to jquery first()?

in jQuery:

$(\".outer .title\").first();
         


        
2条回答
  •  清歌不尽
    2021-01-29 01:22

    Look up CSS selectors - W3Schools CSS Selectors

    This might be what you're looking for though:
    .outer .thing:first-child {}

    You could also try nth-child()

提交回复
热议问题