views:

50

answers:

1

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?

+3  A: 

Try this

.content > h2+p { margin:1px; }
.content > p { margin-top:25px; }

See Demo

Starx
I wanted to add `margin-top: 25px` to `.meta`, as to move it down even with the content in `.content`. This moves the content down instead.
Ethan Turkeltaub
As the h2 and p don't have any parent or child relation to .meta, it is not possible through CSS, You need script to do so.
Starx
Ok, thanks for trying. I'll whip one up with jQuery.
Ethan Turkeltaub