Jump to content

Template:Block center/doc

From Wikibooks, open books for an open world

This template places a block of text in the center of the page, without affecting the text alignment within that block.


Comparison of {{Block center}} and {{Center}}

This template retains the current text alignment (usually left), but moves the entire block of text into the center. To change to centred text alignment, use {{Center}} instead.

Block center

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor.

Aenean massa.

Center
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Aenean commodo ligula eget dolor.

Aenean massa.


Parameters

[edit source]

Where there is a need to give the title of the work, an optional "title" parameter can be used. Sometimes this is will center the title better than a stand-alone line will; other times not - it usually depends on if a fixed width (next example) is forced or not.

{{block center|title=LOREM IPSUM|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.

Aenean massa.}}


LOREM IPSUM

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor.

Aenean massa.

Where there is a requirement to fix the width of the block, an optional "width" parameter can be used. Sometimes this is required to force a wider width when line wrap occurs.

{{block center|width=300px|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.

Aenean massa.}}


Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor.

Aenean massa.

Where there is a need to specify the style of the text, an optional "style" parameter can be used. This parameter takes the same style attributes that can be set for any table.

{{block center|style=font-style:italic|<poem>
Lorem ipsum dolor sit amet,
  consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
  Aenean massa.
</poem>}}


Lorem ipsum dolor sit amet,
  consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
  Aenean massa.