How to select an element if and only if a similar elements exists before

How to select an element if and only if a similar elements exists before

Hi all,

I have the following:
<div id="sidebar">
      <p>Some text</p>
      <p><img src="img.jpg" /></p>
</div>

I need to apply "margin-top: 5px;" to the img within the second <p> only if there is a preceding <p>.
I am not smart enough:o( Please help.

Anders,
Denmark