Reputation: 790
Is it possible to make a custom rule in Css as @media I have a parent class and need to make changes depended on this class as
<div class="parentGreen">
<ul class="ul1">
<li>1</li>
<li>2</li>
</ul>
<ul class="ul2">
<li>1</li>
<li>2</li>
</ul>
</div>
so when i change the parentGreen the items inside their css changes too
@parentGreen{
ul{
direction: ltr
}
}
@parentYellow{
ul{
direction: rtl;
margin:10px;
}
}
Upvotes: 0
Views: 75
Reputation: 2335
Compiled version on this link is what you want.
Do you hear about less? Try searching about it. Less is better choice for creating nested css. You can write like this:
.parent {
.child1 {
color: blue;
}
.child2 {
color: blue;
}
}
Upvotes: 3
Reputation: 18123
This should work...
.parentGreen ul {
direction: ltr
}
.parentYellow ul {
direction: rtl;
margin:10px;
}
Upvotes: 1