<pre>

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Resumo

HTML texto preformatado (<pre>) é a tag utilizada para representar texto pré-formatado. Um texto dentro desse elemento é tipicamente exibido em uma fonte não proporcional da mesma maneira em que o texto original foi disposto no arquivo. Espaços em branco são mantidos no texto da mesma forma em que este foi digitado.

Content categories Flow content, palpable content.

Atributos

Esse elemento apenas inclui atributos globais.

This element only includes the global attributes.

cols Non-standard

Contains the preferred count of characters that a line should have. It was a non-standard synonym of width. To achieve such an effect, use CSS styling instead.

width

Contains the preferred count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS styling instead.

wrap Non-standard

Is a hint indicating how the overflow must happen. In modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use CSS styling instead.

Exemplos

html
<!-- Um exemplo de código css -->
<pre>
body {
  color:red;
}
</pre>

Resultado

body {
  color:red;
}

Especificações

Specification
HTML
# the-pre-element

Compatibilidade de navegador

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
pre
width
DeprecatedNon-standard
wrap
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
See implementation notes.

Veja mais