in Education by
I have a component billing that includes ngb-tabset component of Ng Bootstrap. ngb-tabset has the following DOM element: <!-- Tabset links-->
<!-- Content -->
is dynamically displayed according the selected tab. In my billing.component.scss, the following snippet doesn't work: .tab-content { padding-right: 120px; } The CSS code is correctly compiled and, normally, seen by navigator but not effect on the item. But if I apply it on the item outside the component, the code works correctly. Any idea about this strange behavior? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Method 1 - Set style classes in the tab content template View encapsulation isolates the CSS styling of each component, preventing the parent component CSS from affecting the child components. The preferred solution in the present case would be to set the style classes in the tab content template definition. Here is an example:

Some content

... .my-style-1 { padding-right: 120px; color: magenta; font-style: italic; } See this stackblitz for a demo. Method 2 - Use the ::ng-deep pseudo-class selector Another method is to use the ::ng-deep shadow-piercing descendant combinator to style the content of the NgbTabset child component: ::ng-deep .tab-content { padding-right: 120px; } See this stackblitz for a demo. Method 3 - Turn off view encapsulation Alternatively, you could turn off the view encapsulation of the parent component: import { Component, ViewEncapsulation } from '@angular/core'; @Component({ ... encapsulation: ViewEncapsulation.None }) See this stackblitz for a demo.

Related questions

0 votes
    I have a component billing that includes ngb-tabset component of Ng Bootstrap. ngb-tabset has the following ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a component billing that includes ngb-tabset component of Ng Bootstrap. ngb-tabset has the following ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    .abc{ white-space:pre-wrap; } student:He is a good boy he is also kind' Run code snippetExpand ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I have a very little experience developing UI but I wanted to accomplish a task quickly where I have to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    I'm trying to create an Angular reusable button component. Right now, it is used like so: [label] ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    If you have used inline, internal, and external all the 3 stylings in HTML for a single element then which style will be ... . Inline 2. Internal 3. External 4. None of the above...
asked Jul 12, 2021 in Technology by JackTerrance
0 votes
    7.which of the following is a style available in paragraph style in word processor Select the correct answer from above options...
asked Dec 20, 2021 in Education by JackTerrance
0 votes
    What are the different ways to style a React component?...
asked Dec 5, 2020 in Technology by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Why text inside / list is not affected (color of "item1", "item2" is not changed) by CSS applied ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have this template that I used everywhere in my project : {{ event.title }} {{ event.content } ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    We have a repository of logos that we can look up by ID, but there are a few instances where ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have this template that I used everywhere in my project : {{ event.title }} {{ event.content } ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I need to create an new link from the current route: https://website.com/post/99 = curent browser ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
...