[whatwg] <figure><img><* caption>

On Mon, Nov 30, 2009 at 1:19 PM, Nils Dagsson Moskopp
<nils-dagsson-moskopp at dieweltistgarnichtso.net> wrote:
> "Tab Atkins Jr." <jackalmage at gmail.com> schrieb am Mon, 30 Nov 2009
> 13:00:00 -0600:
>> On Mon, Nov 30, 2009 at 12:57 PM, Nils Dagsson Moskopp
>> <nils-dagsson-moskopp at dieweltistgarnichtso.net> wrote:
>> > "Tab Atkins Jr." <jackalmage at gmail.com> schrieb am Mon, 30 Nov 2009
>> > 12:50:42 -0600:
>> >
>> >> Note: I would style it with "figure > [caption]" instead, to ensure
>> >> you don't accidentally grab misplaced captions.
>> >
>> > I would like to style captions on top differently from captions
>> > underneath. What now ?
>>
>> figure > [caption]:first-child
>> or
>> figure > [caption]:last-child
>
> Apparently, you did not comprehend my question and incorrectly assumed
> that I would always use multiple captions.
>
> So, to make that clear: Without a clear content wrapper, I cannot style
> a preceding caption differently from a following caption.

Apologies, but I have no idea what you're talking about and can only
assume that we're both misunderstanding each other.  My suggested
styling had nothing to do with multiple captions; it was about
targetting a top-caption in a way that wouldn't target a
bottom-caption, and vice versa, so you could style them differently.

Can you provide a code example of what you're talking about?  Here's
what I mean:

figure > [caption]:first-child will target captions like this:
<figure>
  <p caption>foo</p>
  <img>
</figure>

But not ones like this:
<figure>
  <img>
  <p caption>foo</p>
</figure>

figure > [caption]:last-child will do the opposite.

Thus you can use these to style things differently based on whether
you've placed the caption at the top or the bottom of the figure.
(For example, making the <figure> display:table and @caption
display:table-caption, and setting caption-side to be top or bottom
based on the location of the @caption element.)

~TJ

Received on Monday, 30 November 2009 11:34:27 UTC