250x250
Notice
Recent Posts
Recent Comments
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

진스

Deep Selectors (딥 셀릭터) 본문

Css

Deep Selectors (딥 셀릭터)

입방정 2021. 5. 4. 17:39
728x90

 

 

Scoped CSS | Vue Loader

Scoped CSS When a tag has the scoped attribute, its CSS will apply to elements of the current component only. This is similar to the style encapsulation found in Shadow DOM. It comes with some caveats, but doesn't require any polyfills. It is achieved by u

vue-loader.vuejs.org

또 한 이곳도 

 

 

Scoped CSS, deep selector

scoped, Child 컴포넌트의 영향 여부, **deep selector**

velog.io

 

 

Deep Selectors

부모 컴퍼넌트에 있는 엘리먼트 뿐만 아니라 자식 컴퍼넌트에도 동일한 클래스명이 있다면 전부 적용

CSS 에서 사용 하는 방법

 

1
2
3
4
.parent-class >>> .child-class { /* ... */ } // 1번째 사용 방법 
.parent-class[data-v-f3f3eg9] .child-class { /* ... */ } // 2번째 사용 방법
 
 
cs

 

 

 

SCSS 에서 사용하는 방법

1
2
3
4
5
6
7
8
9
10
11
.parent-class { // 1번째 사용 방법 : 이 방법은 deprecated 될 예정이라 2번째 사용 방법으로 사용하자 
& /deep/ .child-class { 
background-color: #000
   }
 } 
.parent-class { // 2번째 사용 방법 
&::v-deep .child-class {
 background-color: #000;
   }
 }
 
cs

 

 

 

Sass와 같은 일부 전처리 기는 >>>제대로 구문 분석 하지 못할 수 있습니다 . 이러한 경우에는 /deep/또는 ::v-deep조합 자를 대신 사용할 수 있습니다. 둘 다 별칭 >>>이며 정확히 동일하게 작동합니다. 위의 예를 기반으로이 두 표현식은 동일한 출력으로 컴파일됩니다.

728x90
Comments