August 21, 2010
CSS Selector for Absence of Tag
Question by Ethan Turkeltaub
Given this HTML:
<div class="entry">
<a class="meta">Aug. 20, 2010</a>
<div class="content">
<h2><a href="#">Hello.</a></h2>
<p>...</p>
</div>
</div>
<div class="entry">
<a class="meta">Aug. 20, 2010</a>
<div class="content">
<p>...</p>
</div>
</div>
And this CSS:
.entry{
width: 760px;
}
.entry .meta{
float: left
width: 160px;
}
.entry .content{
float: right;
width: 600px;
}
Is there a selector to add a margin-top: 25px;
to .entry .meta
in the absence of the <h2>
tag? Or will I need to resort to JavaScript for this?