Reputation: 3648
I've a class named entry
that contains different parts of post article of my web site. Something like below:
<div class="entry">
<div id="author-box-single">
<div class="author-box">
<div class="at-img">
</div>
</div>
</div>
<h1></h1>
<p></p>
<h2></h2>
</div> <!-- End of entry -->
As you see it contains many div
s and headlines and etc. How can I assign one property, for example padding-right: 10px
to all child
s of entry
?
Upvotes: 4
Views: 684
Reputation: 4543
For direct child for div having class entry
, you can use CSS combinators
div.entry > div{
padding-right: 10px;
}
For all the divs (even nested) under div having class entry
div.entry div{
padding-right: 10px;
}
Upvotes: 2
Reputation: 310
*
sign means everything. >
means direct children. For example:
.entry > * {
padding-right: 10px;
}
will assign property to every direct child.
.entry * {
padding-right: 10px;
}
will assign property to everything inside it.
You can use div instead of *
.entry > div {
padding-right: 10px;
}
will assign to all direct <div>
children.
Upvotes: 5