这两种样式规则之间有什么区别? [英] What is the difference between these two style rules?

查看:46
本文介绍了这两种样式规则之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
CSS子代与子代选择器

Possible Duplicate:
CSS Child vs Descendant selectors

那么,这有什么区别?

div a {
  /* Styles here */
}

div > a {
  /* Styles here */
}

我真的不明白.

推荐答案

space子组合器. Child 表示直接后代, descendant 表示父元素子树中某个位置的节点,无论深度如何.

space is the descendant combinator, while > is the child combinator. Child means direct descendant, descendant means a node somewhere in the subtree of the parent element, no matter how deep.

这篇关于这两种样式规则之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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