0

I need change a color for this element

<div class="box download">
    <div class="box-inner-block">
        <a href="" target="_blank" rel="noopener">Plugin Windows</a>
    </div>
</div>

I call a from CSS with:

.download.box-inner-block a {
    color: white!important;
}

But it does not work, why? I need this color only for the element in .box-inner-block inside .download.

dferenc
  • 7,918
  • 12
  • 41
  • 49
Marcus J.Kennedy
  • 680
  • 5
  • 22
  • Possible duplicate of [How to reference nested classes with css?](https://stackoverflow.com/questions/30505225/how-to-reference-nested-classes-with-css) – Suraj Rao Dec 06 '17 at 10:23

2 Answers2

0

Is this what you are looking for as understood in your question ?

If so you need to carefully watch how you indent and construct your css.

As you can see in my snippet I added a space between: .download .box-inner-block a in order to make that work.

You can also remove !important from you css as it will not be useful in that case. If you need it, don't forget to add a space bewtween white and !important

.download {
    background-color: black;
}

.download .box-inner-block a {
    color: white;
}
<div class="box download">
  <div class="box-inner-block">
    <a href="" target="_blank" rel="noopener">Plugin Windows</a>
  </div>
</div>
chicken burger
  • 774
  • 2
  • 12
  • 32
0

You are using the wrong selector, as .download.box-inner-block selects elements which has both download AND box-inner-block classes.

<div class="download box-inner-block"/>

To target nested elements, leave a space between the two class selectors. So the correct selector in your case is:

.download .box-inner-block a {
    color: white;
}

In this case you can drop !important too.

dferenc
  • 7,918
  • 12
  • 41
  • 49