Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic overwrite active element css style

I'd like to change the css style of an activated element.

Here's a ionic-list you can see.

I tried to set the css style of the aktivated element like this:

.item-content.activated{
    background-color: rgba(0,100,255, 0.5);
} 

That doesn't change anything

In the css-framework of ionic I have this line that sets the style of the activated elements:

.item.active, .item.activated, .item-complex.active .item-content, .item-complex.activated .item-content, .item .item-content.active, .item .item-content.activated      
{
   border-color: #ccc;
   background-color: #D9D9D9; 
}

If I change it in the framework, it works. But I only want it to be applied on list items and in my own css-stylesheet ... How can I do that?

like image 427
marcel Avatar asked Aug 04 '14 09:08

marcel


Video Answer


2 Answers

You need to use the selector:

.item .item-content.activated

It has the additional .item so more specificity which is why it is overriding the one you have written.

like image 67
SW4 Avatar answered Sep 19 '22 22:09

SW4


You can do it as follows

.item.active,
.item.activated,
.item-complex.active .item-content,
.item-complex.activated .item-content,
.item .item-content.active,
.item .item-content.activated {
    color: #493F0B;
    font-weight: bold;
    border-color: #eee;
    background-color: #fafafa;
}
like image 25
Fizer Khan Avatar answered Sep 20 '22 22:09

Fizer Khan