Reputation: 25
I have created a simple css class:
.div-toolbar-content {
margin-top: 0px;
margin-bottom: 0px;
}
In the HTML code i want to apply this class to every element that is inside of the parent div:
<div>
<svg></svg>
<p></p>
<select></select>
<i></i>
....
</div>
I have tried putting the class in every element inside the div and it has worked, but is there a way to put the class like in parent div and automatically each element inside the div can apply the class?
Thanks for advices.
Upvotes: 0
Views: 733
Reputation: 464
If you only want to set the styles for the immediate level children's
.div-toolbar-content > *{
margin-top: 0px;
margin-bottom: 0px;
},
otherwise:
.div-toolbar-content * {
margin-top: 0px;
margin-bottom: 0px;
}
Upvotes: 1
Reputation: 686
u can use css for that
div.main > * {
margin-top: 0px;
margin-bottom: 0px;
}
and your HTML
<div class='main'>
<svg></svg>
<p></p>
<select></select>
<i></i>
....
</div>
Upvotes: 3