只有唯一的id选择器或者唯一div怎么选择第一个img标签?

例如:

div.image > img:first-child {}

要么:

div.image > img:nth-child(1) {}

要么:

div > img:first-of-type

注意:nth-​​child()和:first-of-type是CSS3选择器,它们在使用IE时具有一些有限的支持.有关浏览器支持的详细信息

https://www.w3cschool.cn/css3/css3-selector.html#

posted @ 2021-11-23 22:57  web前端小黑  阅读(130)  评论(0)    收藏  举报