At 08:17 AM 2/27/2006, John Lockerbie wrote:
>Paragraphs on my site have an indent of 2em for the second and
>subsequent paragraphs; the first para has no indent. I use
>p + p {
>         text-indent: 2em;
>}
>to effect this.
>
>Where there is an image at the beginning of a para I use
>img + p {
>         text-indent: 2em;
>}
>to keep the indented para.
>
>This works. However, if I have a link from that image, which would
>begin with <a href="http://etc., then there will be no indent.
>
>How do I alter my code to keep the indent?

>If I can't sort out an
>additional rule such as a + img + p (which doesn't work) I'll have to
>use the method you suggest.

a + img + p would select the paragraph in the following markup:

<a>link</a>
<img />
<p>paragraph</p>

Your markup is like this:

<a><img /></a>
<p>paragraph</p>

Is a + p too plebeian?  You'll have to make sure you are OK with code 
order and the cascade, but that selector is the one you want.  Do you 
have instances of links at sibling level with your paragraphs when 
the links do NOT contain images, and you also do not want to preserve 
the indent?  I.e.:

<a>text only link</a>
<p>paragraph</p>  <!-- no indent here? -->

If you do, then you will be forced to use classes.  There is no way 
currently in CSS to do something to a parent (or the sibling of a 
parent) based on the child.

HTH,



-Adam Kuehn 

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to