#StackBounty: How to Change .popover-content CSS for ui-bootstrap popover

Bounty: 50

I am using the ui-bootstrap popover to list some notifications in my application.
I am using the uib-popover-template to design the content of the popover.

I would like to change the padding settings for each elements inside the popover.

I have tried using the popover-class attribute, but this just configures the CSS for the overall popover, and not the elements contained inside – this is what the .popover-content CSS class seems to govern.

Here is the html for the popover:

<span class="glyphicon glyphicon-globe" uib-popover-template="'myNotifications.html'"
        popover-class="my-notifications-popover"></span>

Additionally, I don’t want to do this just by doing:

.popover-content {
     margin: 0px;
}

as I have used popovers in multiple places throughout my application and don’t want them all to get their CSS redefined.

Can anyone tell me how to change this in the correct manner? All help much appreciated…

EDIT 1: I’ve tried to do as suggested in the comments by makshh and use CSS selectors to modify the ‘.popover-content’ class. This class is a div contained within the parent ‘.popover’ class.

I tried to do this with the following:

.my-notifications-popover {
    margin-left: 0px;
}

.my-notifications-popover div {
    margin-left: 0px;
}

This should make the margin-left zero for all child divs of .my-notifications-popover which should be applied to the popover. However it doesn’t seem to be applied at all. This approach may not be ideal since it would set the margin for all divs below the popover which I may not want. Is there a way to specifically target the .popover-content class specifically using the CSS selectors?

I’ve created a plnkr to show exactly how this is not working…. You can see it here: https://plnkr.co/edit/Lr43L5b0YUbZEa5Zkvso


Get this bounty!!!

Leave a Reply