본문 바로가기

HTML 컴퓨터 코드 요소(HTML Computer Code Elements)


Computer Code

1
2
3
4
5
<code>
x = 5;<br>
y = 6;<br>
z = x + y;
</code>
cs


Try it Yourself »




HTML <kbd> For Keyboard Input

키보드 입력을위한 HTML <kbd>


The HTML <kbd> element represents user input, like keyboard input or voice commands.

HTML <kbd>요소는 키보드 입력 또는 음성 명령과 같은 사용자 입력을 나타냅니다.

Text surrounded by <kbd> tags is typically displayed in the browser's default monospace font:

<kbd>태그로 둘러싸인 텍스트 는 일반적으로 브라우저의 기본 고정 폭 글꼴로 표시됩니다.


Example

1
<p>Save the document by pressing <kbd>Ctrl + S</kbd></p>
cs


Result:

Save the document by pressing Ctrl + S

Try it Yourself »



HTML <samp> For Program Output

HTML을위한 <samp> 프로그램 출력


The HTML <samp> element represents output from a program or computing system.

HTML <samp>요소는 프로그램 또는 컴퓨팅 시스템의 출력을 나타냅니다.

Text surrounded by <samp> tags is typically displayed in the browser's default monospace font:

<samp>태그로 둘러싸인 텍스트 는 일반적으로 브라우저의 기본 고정 폭 글꼴로 표시됩니다.


Example

1
<p>If you input wrong value, the program will return <samp>Error!</samp></p>
cs


Result:

If you input wrong value, the program will return Error!


Try it Yourself »



HTML <code> For Computer Code

HTML 코드 <code> 컴퓨터 코드


The HTML <code> element defines a fragment of computer code.

HTML <code>요소는 컴퓨터 코드 조각을 정의합니다.

Text surrounded by <code> tags is typically displayed in the browser's default monospace font: 

<code>태그로 둘러싸인 텍스트 는 일반적으로 브라우저의 기본 고정 폭 글꼴로 표시됩니다. 


Example

1
2
3
4
5
<code>
x = 5;
y = 6;
z = x + y;
</code>
cs


Result:

x = 5; y = 6; z = x + y;


Try it Yourself »


Notice that the <code> element does not preserve extra whitespace and line-breaks.

것을 알 <code>요소가 여분의 공백과 줄 바꿈을 보존하지 않습니다.

To fix this, you can put the <code> element inside a <pre> element:

이 문제를 해결하려면 <code>요소를 요소 안에 넣을 수 있습니다 <pre>.


Example

1
2
3
4
5
6
7
<pre>
<code>
x = 5;
y = 6;
z = x + y;
</code>
</pre>
cs


Result:

x = 5;
y = 6;
z = x + y;



HTML <var> For Variables

변수에 대한 HTML <var>


The HTML <var> element defines a variable.

HTML <var>요소는 변수를 정의합니다.

The variable could be a variable in a mathematical expression or a variable in programming context:

변수는 수학 표현식의 변수이거나 프로그래밍 컨텍스트의 변수 일 수 있습니다.


Example

1
Einstein wrote: <var>E</var> = <var>mc</var><sup>2</sup>.
cs


Result:

Einstein wrote: E = mc2.

Try it Yourself »



Test Yourself with Exercises!



HTML Computer Code Elements

HTML 컴퓨터 코드 요소


Tag 

 Description

 <code> 

 Defines programming code

 프로그래밍 코드를 정의합니다.

 <kbd> 

 Defines keyboard input 

 키보드 입력을 정의합니다.

 <samp> 

 Defines computer output

 컴퓨터 출력을 정의합니다.

 <var> 

 Defines a variable

 변수를 정의합니다.

 <pre>

 Defines preformatted text

 미리 포맷 된 텍스트를 정의합니다.




출처 : w3schools.com


'HTML' 카테고리의 다른 글

HTML 기호(HTML Symbols)  (0) 2018.06.28
HTML 개체(HTML Entities)  (0) 2018.06.27
HTML 반응 형 웹 디자인(HTML Responsive Web Design)  (1) 2018.06.25
HTML 레이아웃(HTML Layouts)  (0) 2018.06.24
HTML 헤드(HTML Head)  (0) 2018.06.23