18

I saw the following CSS code with what appears to be a triple greater than selector.

.b-table >>> .table-wrapper {
  overflow-x: auto; 
}

I know it's referencing a Buefy table component and applying a specific style to elements that have a table-wrapper class, but what does the >>>operator mean exactly? Based off this answer I'm thinking it might be for applying styles to children of children of children, is that accurate? If so, why doesn't it seem to work with other amounts of >?

5
  • 3
    This is not valid CSS. Are you using a preprocessor? Commented Apr 22, 2019 at 21:06
  • Interesting. I think the codebase is using Sass and PostCSS. Commented Apr 22, 2019 at 21:08
  • Are you using an older version of Angular? If so it's a deprecated equivalent to ::ng-deep Commented Apr 22, 2019 at 21:10
  • @Chris W. No, it's using Vue. Commented Apr 22, 2019 at 21:12
  • 5
    Vue uses it also. Commented Apr 22, 2019 at 21:14

2 Answers 2

19

>>> operator is Vue.js specific feature and called deep selector. In scoped CSS, you cannot apply CSS to child components without deep selector.

As your example, these two selector won't be applied.

<style scoped>
.table-wrapper {
  overflow-x: auto !important;  /* won't work */
}
.b-table .table-wrapper {
  overflow-x: auto !important;   /* won't work */
}
</style>

It needs deep selector.

<style scoped>
.b-table >>> .table-wrapper {
  overflow-x: auto; 
}
</style>
Sign up to request clarification or add additional context in comments.

Comments

1

It is shadow-piercing descendant combinator. In Angular, >>>, /deep/ and ::ng-deep are the same (source: https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep). It is deprecated and support has ben removed from major browsers. For example, it has been removed since Chrome version 63, around December 5 2017 (source: https://www.chromestatus.com/feature/6750456638341120)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.