Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to change the background color of a box – CSS

I am looking after a portal on a low-code platform. I am trying to update the background-color for a box on our portal, however am really struggling to update this.

I have copied the selector and also included a screenshot from the console.

If someone could point me in the right direction I would really appreciate that.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

console

div.ideas-list–cntr.ng-scope > div > div.panel.panel-default.ideas-list–panel > div > div.panel-body.ideas-list–content > ul > li:nth-child(1) > div > div.idea-details–cntr > div.ideas-categories–cntr > a

Thanks
Mike

I have tried updating the background color as follows and was expecting a white background for the box:

.ideas-list--panel .ideas-categories--cntr a {
  background-color: white;
}

However, I am still seeing #33466C background color.
box

>Solution :

In order to override the backgorund color the new rule should have bigger specificity than the rule you’re overriding, you can achieve this either by:

  • adding your overriding rule after the original CSS in HTML,
  • increasing the specificity of the selector with techniques like repeating a class, for example .ideas-list--panel.ideas-list--panel .ideas-categories--cntr a,
  • or ending the declaration with !important

These techniques are ordered starting from the ideal practice, so pick the one that is easiest for you.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading