html - 有没有办法使用css在html中隐藏没有id或class的元素?
问题描述
所以我有一个问题,将第 n 个元素隐藏在没有 id 但其父 div 有 ID 的 div 中。我想隐藏显示“第二个”的第二个跨度
<div id="example">
<div>
<span>First</span>
<span>Second</span>
</div>
</div>
解决方案
#example span:nth-of-type(2){
display:none
}
推荐阅读
- docker - Docker 构建会丢失在 RUN 序列中完成的所有内容
- javascript - 如何使用 dotenv 在脚本 src 中隐藏 api 键
- python - X的N次方的Python分而治之的实现
- javascript - MySQL - GROUP BY、JSON、LIMIT 5 等
- javascript - 我的 Gatsby 项目是否存在 React 的补液问题?
- scala - 在Scala中使用带有Set类型的while和for循环之间的区别
- sql - 在 SQL Server 行中存储大于 8kB 的数据是不好的做法吗?
- java - 如何成功实现从活动迁移到片段的 viewpager 和 recyclerView
- excel - 合并文件夹中的所有工作簿并移动到子文件夹
- php - 从 PHP 中的下拉列表中过滤搜索结果