“>"和有什么区别?和CSS选择器中的空格? [英] What is the difference between '>' and a space in CSS selectors?

查看:123
本文介绍了“>"和有什么区别?和CSS选择器中的空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用这种语法有什么意义

What's the point using this syntax

div.card > div.name

这有什么区别

div.card div.name

推荐答案

A > B将仅选择直接作为A的子级的B(也就是说,它们之间没有其他元素).

A > B will only select B that are direct children to A (that is, there are no other elements inbetween).

A B将选择A内的任何B,即使它们之间还有其他元素.

A B will select any B that are inside A, even if there are other elements between them.

这篇关于“>"和有什么区别?和CSS选择器中的空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆