0

I have a modal window with a bootstrap modal-content class, where I need to change the background color to transparent for a particular modal. Because this has been set up for me, I can't actually add classes to the modal-content div.

I only want to change this property if the div within this contains the class erm-modal. Currently my Less file looks like this:

modal-content {
  background-color: transparent;
  .erm-modal {
     ......
  }
}

This changes my background color correctly, but also changes the background color for all the other modals as well! Can I write some less to allow me to only change this property if the child div contains .erm-modal?

I am using AngularJS if that makes a difference.

Thanks

MDalt
  • 1,681
  • 2
  • 24
  • 46
  • 1
    No, you can not style the parent in any way from the perspective of a child's selector (by now its simply impossible in CSS and thus in Less too). So you'll have to rethink your HTML/CSS structure. – seven-phases-max Oct 27 '15 at 21:56
  • Agree with @seven-phases-max' comment. You would either have to rethink the markup/structure (or) use Javascript. I am not recommending the use of jQuery but if you are already using it then try the `:has()`. – Harry Oct 28 '15 at 04:49
  • Possible duplicate of [CSS selector for "foo that contains bar"?](http://stackoverflow.com/questions/2000582/css-selector-for-foo-that-contains-bar) – JotaBe Nov 02 '15 at 17:09

0 Answers0