How To Use /deep/ or >>> in Vue.js?

In Vue, use /deep/ or >>> to style child components from a parent. For Vue 3, use the modern :deep() instead.

Summarize with AI

Not enough time? get the key points instantly.

When working with scoped CSS in Vue.js you may need to style elements inside child components from a parent component. By default scoped styles do not penetrate into child components but Vue provides special selectors to allow this: /deep/, >>>, ::v-deep and the modern :deep() pseudo-class.

How the >>> or /deep/ Works

The >>> (sometimes called the “deep combinator” or “descendant combinator”) and its alias /deep/ (which was widely used in older versions) allowed you to “pierce” through the style encapsulation of a child component.

Deprecated Syntax

/deep/ and >>> were the original ways to write deep selectors in Vue 2.

  

 

Worth Reading

Key Takeaway

The >>> and and /deep/ are deprecated for styling deeply nested elements within scoped Vue components. The modern and correct way to achieve this is using the :deep() pseudo-class.

Use it cautiously as it bypasses the benefits of CSS scoping and can lead to less maintainable styles. Prioritize props, slots and CSS variables for styling child components whenever possible.


Resources

Insights from our engineering leaders.

Our team shares practical insights on the technologies and engineering decisions shaping enterprise software today, grounded in real client work.