MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

개요

HTML Preformatted 텍스트 (<pre>) 는  HTML <pre> 요소는 미리 서식이 지정된 텍스트를 나타냅니다(Mark-up). 이 요소 내의 텍스트는 대게 파일에 쓰여졌던 그대로 (요소 밖 텍스트와는) 비례하지 않는 글꼴로 표시됩니다. 이 요소 내 빈 칸(white-space) 또한 타이핑한대로  입력됩니다.

속성

이 요소는 전역 속성만을 포함합니다.

cols
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
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.

예제

<!-- Some example CSS code -->
<pre>
body {
  color:red;
}
</pre> 

결과

body {
  color:red;
}

명세

명세 상태 주석
WHATWG HTML Living Standard
The definition of '<pre>' in that specification.
Living Standard No significant change from WHATWG HTML Living Standard
HTML5
The definition of '<pre>' in that specification.
Recommendation No significant change from HTML 4.01 Specification
HTML 4.01 Specification
The definition of '<dl>' in that specification.
Recommendation Deprecated the cols attribute

브라우저 호환성

특징 Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.7 or earlier) (Yes) (Yes) (Yes)
width (Yes)
No layout effect
1.0 (1.7 or earlier)
Layout effect removed in 29.0 (29.0)
(Yes)
No layout effect
(Yes)
No layout effect
(Yes)
No layout effect
cols No support 1.0 (1.7 or earlier)
Removed in 29.0 (29.0)
No support No support No support
wrap ? 1.0 (1.7 or earlier) ? ? ?
특징 Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) 1.0 (1.0) (Yes) (Yes) (Yes)
width ? 1.0 (1.0)
Layout effect removed in 29.0 (29.0)
? ? ?
cols No support 1.0 (1.0) No support No support No support
wrap ? 1.0 (1.0) ? ? ?

참고

문서 태그 및 공헌자

 이 페이지의 공헌자: ehfgk78, azunyan3
 최종 변경: ehfgk78,