سؤال

I have the following HTML:

<div class="tocolor">tocolor 1
<div id="one">tocolor 11</div>
</div>
<div class="mplampla"><span id="two">
</span>tocolor 2</div>
<div class="tocolor-2"><span id="three">
</span>tocolor 3</div>
<div class="tocolor tocolor-1">tocolor 4 
<span id="one">tocolor 44</span>
</div>

and I want to style (let's say color green) "tocolor 11" using a combination of atrribute selectors. I tried the following CSS but it doesn't do anything

div[class*='tocolor'][div[id*='one']] {
color:green
}

Thanks

هل كانت مفيدة؟

المحلول

Used to this

div[class*='tocolor'] div[id*='one'] {
    color:green
    }

and this

 div[class*='tocolor'] > div[id*='one'] {
        color:green
        }

Demo

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top