Predefinição:Bloco centro/doc

Wikisource, a biblioteca livre
Saltar para a navegação Saltar para a pesquisa

Função[editar]

Esta predefinição coloca um bloco no centro da página, sem afetar o alinhamento do texto.

{{bc}} é uma abreviação desta predefinição que redireciona para cá.

Uso[editar]

{{bloco centro|width=|style=|align=|title=|texto}}

Onde:

  • {{bloco centro: é a predefinição padrão;
  • |width: é a largura do bloco;
  • |style: é o estilo do texto;
  • |align: é o alinhamento do texto;
  • |title: é o título do texto, se houver;
  • texto}}: é o texto.
Comparação de of {{Bloco centro}} e {{centro}}

Esta predefinição mantém o alinhamento atual do texto (por padrão, à esquerda), mas move todo o bloco de texto para o centro da página. Para alinhar o texto em si ao centro, use {{Centralizado}} ao invés desta predefinição.

Bloco centro

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

Aenean massa.

Centralizado
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Aenean commodo ligula eget dolor.

Aenean massa.


Parâmetros[editar]

Todos os parâmetros são opcionais.

  • title: Title of the block (optional)
  • width: the width of the block
  • max-width: the maximum width of the block. Optional: default 100%.
  • align: the text alignment within the block. One of left, right, center, justify, default is unspecified and so inherits from the parent.
  • class: additional CSS classes, which can be used in conjunction with en:Help:Page styles CSS. The classes wst-block-center and wst-block-center-title are always applied to the block and to the title respectively.
  • style: additional CSS styles (prefer a class if the style is re-used within a work)

title[editar]

Onde é necessário dar título á obra, um parâmetro opcional "title" pode ser utilizado. Por vezes isto irá centrar o título melhor do que uma linha separada para título; outras vezes não, costuma depender se uma largura fixe (exemplo seguinte) é ou não forçada.

{{bloco centro|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.

width[editar]

Onde existe a necessidade de fixar a largura do bloco, um parâmtero optcional "width" pode ser utilizado. Por vezes isto é necessário para forçar uma largura maior, quando ocorre line wrap.

{{bloco centro|width=25em|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.

Nota: isto vai forçar uma largura específica mesmo quando a página é mais estreita do que esta largura, até um máximo especificado em max-width, ou 100% se este parâmetro não estiver definido.

Note: geralmente, evite usar percentagens, uma vez que serão demasiadamente estreitas para écrans pequenos. Se o contexto é textual, é preferível usar unidades relativas de texto CSS, tal como em. Ver en:H:PXWIDTH para mais detalhes.

max-width[editar]

This parameter provides a maximum width for the block, such that no matter how wide the parent container, the centred block will be no wider than this. Very often, this is a better choice than width, because it allows content to shrink on smaller screens like e-readers.

{{block center|max-width=15em|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna }}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna

However, if the parent container is smaller that this value, the block will shrink as normal:

<div style="width:10em; margin:auto;">
{{block center|max-width=15em|
Lorem ipsum dolor sit amet, consectetur adipisicing elit
}}
</div>

Lorem ipsum dolor sit amet, consectetur adipisicing elit

The two parameters can be combined. In this case, the width will be set according to the width parameter on small screens (below the max-width value), and then will be limited to the max-width value on large screens. Note that the width value has to change according to the parent size, so it's normally a percentage value (often 100%).

This is useful when there are floated blocks that don't cause the block to expand to the correct width, but where it's still desirable for the block to shrink on smaller screens:

<div style="width:100%; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Wide parent: max-width of 40em applies.{{-}}{{float right|''Text on the right.''}}
}}
</div>
Wide parent: max-width of 40em applies.
Text on the right.
<div style="width:30em; margin:auto; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Narrow parent: 100% width{{-}}{{float right|''Text on the right.''}}
}}
</div>
Narrow parent: 100% width
No overflow of parent.

style[editar]

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,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}


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

align[editar]

The text alignment within the (overall) centered block may be controlled using this (default: left):

{{block center|align=right|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}


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

Blocos com múltiplas páginas[editar]

Se usar vários blocos centro separados, irá reparar que cada página tem um alinhamento ligeiramente diferente. Não obstante, esta predefinição não pode ser deixada aberta numa página e fechada noutra para criar um grande bloco centrado. Para usar o bloco centro em múltiplas páginas, pode usar-se {{bloco centro/c}} e {{bloco centro/f}} para abrir e fechar o bloco em cada página. Todas as páginas têm de ter um de cada, no início e fim da secção. Contudo, é possível colocar um ou ambos no cabeçalho e rodapé, para que não sejam transcluídos para a página principal. Quando todas as páginas forem transcluídas, o resultado será só um {{bloco centro/c}} e um {{bloco centro/f}} no início e fim da secção, respectivamente.

Primeira página[editar]

Cabeçalho

Nada é necessário no cabeçalho.

Corpo de texto
{{bloco centro/c}}
Início do texto bloco centro.
Conteúdo do bloco centro aqui.
Rodapé
{{bloco centro/f}}

Páginas centrais[editar]

Cabeçalho
{{bloco centro/c}}
Corpo de texto
Conteúdo do bloco centro aqui; isto continua a página anterior.
Footer
{{bloco centro/f}}

Última página[editar]

Cabeçalho
{{bloco centro/c}}

Corpo de texto
Conteúdo do bloco centro aqui; isto continua a página anterior.
Final do texto em bloco centro
{{bloco centro/f}}
Rodapé

Nada é necessário no rodapé da última página.

See Also[editar]

Redirecionamento[editar]

  • {{Bc}}

Sem descrição.

Parâmetros da predefinição

Esta predefinição prefere a formatação em bloco dos parâmetros.

ParâmetroDescriçãoTipoEstado
classclass

additional CSS classes, which can be used in conjunction with Help:Page styles CSS. The classes wst-block-center and wst-block-center-title are always applied to the block and to the title respectively.

Conteúdoopcional
widthwidth

The width of the block (needs units which are valid CSS units.)

Conteúdorecomendado
taligntalign align

the text alignment within the block. One of left, right, center, justify, default is unspecified and so inherits from the parent.

Valores sugeridos
left, right, center
Desconhecidorecomendado
max-widthmax-width

sem descrição

Desconhecidoopcional
stylestyle

Additional CSS styles (prefer a class if the style is re-used within a work)

Conteúdoopcional
titletitle

Title of the block

Conteúdoopcional
bodybody 1

The text to be placed centrally as a block

Conteúdoopcional