css-selectors - 另一个类中包含的第一次出现的类的 CSS 选择器
问题描述
我想访问包含在类 y 中的 class=x 的第一个元素。我有这个作为我的选择器 '.x .y' 但这会选择类 x 中包含的类 y 的所有元素。我只想要第一个。我怎么能用选择器做到这一点?
解决方案
像这样的东西应该工作:
.x .y:first-of-type{
/* Your CSS code here */
}
推荐阅读
- css - 将字体系列从 Segoe 更改为 Futura (Bulma)
- amazon-web-services - 在 AWS Gateway 中导入 Spring 的 OpenApi 文件
- c - 简单高斯消除代码中的“for”循环问题
- kotlin - Kotlin VAL 变量的数据分配
- python - 使用 RabbitMQ 时如何同步 Node.js 和 Python 即在 worker 上运行任务,等待结果并将其发送到客户端
- c# - Bing Maps Terrain 地图样式只是带有一些标题的道路样式吗?
- c# - gRPC 服务器 .net 框架 - 如何配置为使用 TLS 证书
- python - 从python中的矩阵(数组)递归生成树节点(无二进制)
- r - 计算相似行的频率但保持相同大小的数据框
- html - 如何使用 flexbox 将一组 div 一起“洗牌”