<code>: 인라인 코드 요소
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.
Please take two minutes to fill out our short survey.
HTML <code>
요소는 짧은 코드 조각을 나타내는 스타일을 사용해 자신의 콘텐츠를 표시합니다. 기본 스타일은 사용자 에이전트의 고정폭 글씨체입니다.
시도해 보기
<p>
The <code>push()</code> method adds one or more elements to the end of an
array and returns the new length of the array.
</p>
code {
background-color: #eee;
border-radius: 3px;
font-family: courier, monospace;
padding: 0 3px;
}
특성
이 요소는 전역 특성만 포함합니다.
예제
html
<p>
함수 <code>selectAll()</code>는 입력 필드의 모든 텍스트를 선택하므로, 사용자가
복사 혹은 삭제를 손쉽게 할 수 있습니다.
</p>
참고
여러 줄의 코드를 나타내려면 <code>
요소를 <pre>
로 감싸세요. 보통 상황에서 <code>
는 코드 한 줄만 나타냅니다.
CSS code
태그 선택자를 사용해 브라우저의 기본 글씨체를 바꿀 수 있습니다. 그러나 사용자 설정이 CSS보다 우선할 수도 있습니다.
명세
Specification |
---|
HTML # the-code-element |