--- title:
slug: Web/HTML/Element/pre
translation_of: Web/HTML/Element/pre
---

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.

{{htmlattrdef("cols")}} {{non-standard_inline}}{{obsolete_inline}}
Contains the preferred count of characters that a line should have. It was a non-standard synonym of {{htmlattrxref("width", "pre")}}. To achieve such an effect, use CSS styling instead.
{{htmlattrdef("width")}} {{obsolete_inline}}
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.
{{htmlattrdef("wrap")}} {{non-standard_inline}}
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

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

Resultado

body {
  color:red;
}

Especificações

Especificação Status Comentário
{{SpecName('HTML WHATWG', 'grouping-content.html#the-pre-element', '<pre>')}} {{Spec2('HTML WHATWG')}} Nenhuma mudança significante na {{SpecName("HTML WHATWG")}}
{{SpecName('HTML5 W3C', 'grouping-content.html#the-pre-element', '<pre>')}} {{Spec2('HTML5 W3C')}} Nenhuma mudança significante na {{SpecName("HTML4.01")}}
{{SpecName('HTML4.01', 'struct/text.html#h-9.3.4', '<dl>')}} {{Spec2('HTML4.01')}} Atributto cols obsoleto

Compatibilidade de navegador

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
width {{CompatVersionUnknown}}
No layout effect
{{CompatGeckoDesktop("1.0")}}
Layout effect removed in {{CompatGeckoDesktop("29.0")}}
{{CompatVersionUnknown}}
No layout effect
{{CompatVersionUnknown}}
No layout effect
{{CompatVersionUnknown}}
No layout effect
cols {{CompatNo}} {{CompatGeckoDesktop("1.0")}}
Removed in {{CompatGeckoDesktop("29.0")}}
{{CompatNo}} {{CompatNo}} {{CompatNo}}
wrap {{CompatUnknown}} {{CompatGeckoDesktop("1.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
width {{CompatUnknown}} {{CompatGeckoMobile("1.0")}}
Layout effect removed in {{CompatGeckoMobile("29.0")}}
{{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
cols {{CompatNo}} {{CompatGeckoMobile("1.0")}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
wrap {{CompatUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

Veja mais

{{ HTMLRef }}