13 jun 2011 kl. 16.03 skrev MiB:

What strategies beyond setting a class for the first paragraph could
there be for indenting the first line of all paragraphs but not the
first one when it is not the first-child element? I guess I could add
a span around all the paragraphs, but I don't really want to resort to
that. Yet.

HTML fragment:
<div id="wrapper">
<!--<h3>Heorthwerod</h3>--> <!--Uncommenting this one makes the header
the first-child element-->
<p>Maelde, fleogan frith me beot mid sendon; forth hafoc fleogan and
be gar, him hu se saemannum, he thu daelon. Thaet hyssa, tha clypode
golde he handon mid and; getrymmed tham rad her thu. And to frean
thaer to, sendan ne me leofost to saemannum that garraes heton he his
be his wolde wige lysan stod.</p>
<p>Heorthwerod tham het gefeohte willath tham tha we saemannum her
mihte his; he getholian sceoldon afysan daelon? Healdan frith wige —
he heoldon mid forhtedon? </p>
</div>

I settled for a combinator selector h3+p as all first paragraphs in the relevant section will be preceeded by the h3-element. Like this:

#wrapper h3+p { text-indent: 0; }

This may bite when I get to IE7-tests, but for now it's a solution.

Anyone have an even better idea?



CSS fragment:

#wrapper p { text-indent: 0.8em; }
#wrapper p:first-child { text-indent: 0; }

#wrapper {
        border: medium dotted #EF7777;
        width: 50%;
}






/MiB




--
--
You received this because you are subscribed to the "Design the Web with CSS" 
at Google groups.
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to