descendant combinator — typically represented by a single space ( ) character — combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors .

/* List items that are descendants of the "my-things" list */
ul.my-things li {
  margin: 2em;
}
					

The descendant combinator is technically one or more CSS white space characters — the space character and/or one of four control characters: carriage return, form feed, new line, and tab characters — between two selectors in the absence of another combinator. Additionally, the white space characters of which the combinator is comprised may contain any number of CSS comments.

句法

selector1 selector2 {
  /* property declarations */
}
					

范例

CSS

li {
  list-style-type: disc;
}
li li {
  list-style-type: circle;
}
					

HTML

<ul>
  <li>
    <div>Item 1</div>
    <ul>
      <li>Subitem A</li>
      <li>Subitem B</li>
    </ul>
  </li>
  <li>
    <div>Item 2</div>
    <ul>
      <li>Subitem A</li>
      <li>Subitem B</li>
    </ul>
  </li>
</ul>
					

结果

规范

规范 状态 注释
Selectors Level 4
The definition of 'descendant combinator' in that specification.
工作草案
Selectors Level 3
The definition of 'descendant combinator' in that specification.
推荐
CSS Level 2 (Revision 1)
The definition of 'descendant selectors' in that specification.
推荐
CSS Level 1
The definition of 'contextual selectors' in that specification.
推荐 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Descendant combinator ( A B ) Chrome 完整支持 1
完整支持 1
完整支持 61 注意事项
注意事项 >>> is aliased to this selector since its use as the 'shadow-piercing descendant combinator' was deprecated .
Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 3 Opera 完整支持 3.5 Safari 完整支持 1 WebView Android 完整支持 ≤37
完整支持 ≤37
完整支持 61 注意事项
注意事项 >>> is aliased to this selector since its use as the 'shadow-piercing descendant combinator' was deprecated .
Chrome Android 完整支持 18
完整支持 18
完整支持 61 注意事项
注意事项 >>> is aliased to this selector since its use as the 'shadow-piercing descendant combinator' was deprecated .
Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 1 Samsung Internet Android 完整支持 1.0
完整支持 1.0
完整支持 8.0 注意事项
注意事项 >>> is aliased to this selector since its use as the 'shadow-piercing descendant combinator' was deprecated .
A >> B syntax 弃用 Chrome 不支持 No Edge 不支持 No Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 10 — 11.1 WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 10 — 11.3 Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Selectors
  4. 指南
    1. Using the :target pseudo-class in selectors
  5. 特性
    1. 选择器列表
  6. Basic Selectors
    1. Type selectors
    2. Class selectors
    3. ID selectors
    4. Universal selectors
    5. Attribute selectors
  7. 组合器
    1. Adjacent sibling combinator
    2. General sibling combinator
    3. Child combinator
    4. Descendant combinator
    5. Column combinator
  8. Pseudo-classes
    1. :active
    2. :any-link
    3. :checked
    4. :blank
    5. :default
    6. :defined
    7. :dir()
    8. :disabled
    9. :empty
    10. :enabled
    11. :first
    12. :first-child
    13. :first-of-type
    14. :fullscreen
    15. :focus
    16. :focus-visible
    17. :focus-within
    18. :has()
    19. :host()
    20. :host-context()
    21. :hover
    22. :indeterminate
    23. :in-range
    24. :invalid
    25. :is() (:matches(), :any())
    26. :lang()
    27. :last-child
    28. :last-of-type
    29. :left
    30. :link
    31. :not()
    32. :nth-child()
    33. :nth-last-child()
    34. :nth-last-of-type()
    35. :nth-of-type()
    36. :only-child
    37. :only-of-type
    38. :optional
    39. :out-of-range
    40. :placeholder-shown
    41. :read-only
    42. :read-write
    43. :required
    44. :right
    45. :root
    46. :scope
    47. :target
    48. :valid
    49. :visited
    50. :where()
  9. Pseudo-elements
    1. ::-moz-progress-bar
    2. ::-moz-range-progress
    3. ::-moz-range-thumb
    4. ::-moz-range-track
    5. ::-webkit-progress-bar
    6. ::-webkit-progress-value
    7. ::-webkit-slider-runnable-track
    8. ::-webkit-slider-thumb
    9. ::after (:after)
    10. ::backdrop
    11. ::before (:before)
    12. ::cue
    13. ::cue-region
    14. ::first-letter (:first-letter)
    15. ::first-line (:first-line)
    16. ::grammar-error
    17. ::marker
    18. ::part()
    19. ::placeholder
    20. ::selection
    21. ::slotted()
    22. ::spelling-error

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1