css - 了解“空格键”和 > 选择元素之间的区别
问题描述
所以我必须阅读我正在做的一个项目的以下几行,另一个人写了以下内容
> inner > .button-container inner {
background: radial-gradient(circle, rgba(255,255,255, 0.2), transparent);
}
(我没有添加html代码,因为它是由程序生成的,很纠结,我什至无法完全理解)
所以根据我从 w3schools vs ">" 的笔记,意思如下
* +-----------------------------------------------------------------------------------------------------------+
* |CSS Selectors |
* +-----------------------------------------------------------------------------------------------------------|
* |Selector |Example |Example Description |
* +---- ---------------+--------------------+----------------------------------------------+-----------------|
* |.class1 .class2 |.name1 .name2 |all elements with name2 that is a descendant of an element |
* | | | with name1 |
* |element>element |div > p |all <p> elements where te parent is a <div> element |
* +-----------------------------------------------------------------------------------------------------------+
然后我会将此语法理解为 Select all the elements that: 对应于标签 html inner ,它们是类 .button-container 的后代,它们是 html 标签内部的后代
但是我看不出像这样选择它们或这样做之间有什么区别
inner > .button-container > inner {};
inner .button.container inner {};
以及这两个选择器可能的所有组合。
谁能正确解释这种语法?
解决方案
推荐阅读
- c# - 从磁盘显示大量图像的最佳方法
- python - 带有 Django 项目和 MS SQL 数据库的 GitLab CI 无法登录
- php - 将原始数据传递给邮递员时出现错误
- ruby-on-rails - ruby-elasticsearch 创建带有属性的索引查询不起作用
- spring-boot - 恰好有一次生产者变慢
- python - 如何在 Python 中生成具有许多零值的随机数列表?
- c - 文件问题中的错误输出但是当我用 1 个正确的输出替换 7 时
- sql-server - OPENDATASOURCE 在@DynamicSQL 中不起作用
- python - 在使用所有身份验证的 Django 中,我想为下面提供的以下信息制作一个没有 REST 框架的自定义 API
- javascript - 我想生成多个随机数并将它们相加,但所有数字的相加必须等于 100