HTML <code>
요소는 짧은 코드 조각을 나타내는 스타일을 사용해 자신의 콘텐츠를 표시합니다. 기본 스타일은 사용자 에이전트의 고정폭 글씨체입니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
콘텐츠 카테고리 | 플로우 콘텐츠, 구문 콘텐츠, 뚜렷한 콘텐츠. |
---|---|
가능한 콘텐츠 | 구문 콘텐츠. |
태그 생략 | None, both the starting and ending tag are mandatory. |
가능한 부모 요소 | 구문 콘텐츠를 허용하는 모든 요소. |
가능한 ARIA 역할 | 모두 |
DOM 인터페이스 | HTMLElement |
특성
이 요소는 전역 특성만 포함합니다.
예제
<p>함수 <code>selectAll()</code>는 입력 필드의 모든 텍스트를 선택하므로,
사용자가 복사 혹은 삭제를 손쉽게 할 수 있습니다.</p>
참고
여러 줄의 코드를 나타내려면 <code>
요소를 <pre>
로 감싸세요. 보통 상황에서 <code>
는 코드 한 줄만 나타냅니다.
CSS code
태그 선택자를 사용해 브라우저의 기본 글씨체를 바꿀 수 있습니다. 그러나 사용자 설정이 CSS보다 우선할 수도 있습니다.
명세
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<code>' in that specification. |
Living Standard | |
HTML5 The definition of '<code>' in that specification. |
Recommendation | |
HTML 4.01 Specification The definition of '<code>' in that specification. |
Recommendation |
브라우저 호환성
BCD tables only load in the browser