RE: Floating a figure next to the preceding paragraph

> -----Original Message-----
> From: Christoph Päper [mailto:christoph.paeper@crissov.de]
> Sent: Thursday, January 12, 2012 10:07 AM
> 
> A pattern I come across frequently, e.g. on Wikipedia, is a paragraph that
> semantically introduces a figure and, therefore, in markup the text should
> also come before the table or embedded picture, but they should be
> displayed side-by-side, with the figure starting at the same vertical position
> as the paragraph (i.e. aligned top edges) or at the next available position
> below.
> 
>   <article>.
>     <p>Foo</p>
>     <figure>Bar</figure>
>   .</article>
> 
>   Foo    Bar
> 

You can use an absolutely positioned exclusion (see the css3-exclusions module) here quite naturally. The only requirement would be to make the <article> an absolutely positioned container ('positoin:relative'). The following will be all that's needed to make your figure an exclusion.

figure {
  wrap-flow: left; /* in this case 'both' would do as well */
  position: absolute;
  top: 0px; 
  right: 0px;
}

Cheers,
Rossen

Received on Tuesday, 17 January 2012 03:25:54 UTC