-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I override the style of a popover? #1707
Comments
Ok, I managed to do it by setting the body as the container of the popover:
Then I added the next css to the global style of my application:
I really don't like the idea of using !important in any of my app's css though, that's like the last resource. I would appreciate if you guys have better ideas. |
Lucky you. I can't get it to work even with container="body" AND using !important. |
Try to use @Component({
selector: "your-component",
templateUrl: "your-template.component.html",
styles: [`
:host >>> .popover {
color: #000;
max-width: 100%;
}
`]
}) |
@mechu solution is working (solution write on the documentation). but how to do if you are using an external styling file ?
my pr-test.component.scss file ->
Thanks |
:host doesn't help when container is body. :host gets applied to the container of the link used to initiate the popover. There is no way to apply styles to multiple popovers on a page. |
RaviNags, use
Had also some issues with |
@h6784rfg6 That worked well for me. Does anyone know if there is a more supported way at this point? I see that there is a "containerClass" input, but I wasn't able to successfully access that class from a "styleUrl" linked .scss doc. |
@mechu awesome!! couldn't figure out how to target a class created after compilation in Angular. Your solution hit the spot. Now I know how to do it. 🙌🏻 |
This worked for me. Thanks. |
|
Nothing is working for me from the aforementioned as well. Working with Angular 9 |
@robtong21 you can try :host ::ng-deep .popover { /deep/ is not working now. |
Have you tried using "containerClass" and setting a custom class for it? |
@component({ Use Encapsulation => ViewEncapsulation.None in the Ts file like the example showing above, this will 100% work |
I have a popover in my component but it doesn't display correctly when I include the text on it. The text is overflowing the popover, I need the text not to be wrapped.
By doing my search on the internet, this is a common problem which gets solved by overriding the popover property "max-width" to be 100%, I proved that in the browser's debugger and it works. The problem is that I don't seem to be able to set/override this property from my component's css file.
I have tried:
.popover { max-width: 100%; }
and
.popover-content { width: 100%; }
and
.popover-content, .popover-content .body { width: 100%; }
None of them have worked, any thoughts?
The text was updated successfully, but these errors were encountered: