티스토리 뷰

 

HTML에서

text tag와 특수문자 입력에 대해 정리

 

1. Text formatting

-<b>, <strong> : 글자 굵게

Life is full of <b>ups and downs</b>.
		<!--글자 굵게-->
Life is full of <strong>ups and downs</strong>.
		<!--strong 태그가 감싸고 있는 텍스트가 중요하다는 정보 내포 -->

 

-<i>, <em> : 글자 기울이기

Life is full of <i>ups and downs</i>.
		<!--글자 기울이기-->
Life is full of <em>ups and downs</em>.
		<!--em 태그로 감싸고 있는 텍스트를 강조한다는 정보 내포-->

 

-<small>

Life is full of <small>ups and downs</small>.
		<!-- 글자 작게 -->

 

-<sub>, <sup>

Life is full of <sup>ups</sup> and <sub>downs</sub>.
		<!--sup은 윗첨자, sub 아래첨자-->

 

-<ins>, <del>

Life is full of <ins>ups</ins> and <del>downs</del>.
		<!--ins은 밑줄, del은 취소선-->

 

-<mark>

Life is <mark>full of ups and downs</mark>.
<!--노란색 형광펜을 그은 것과 같은 효과를 줌-->

 

-etc

(*<pre>  : 사용자 입력 그대로 출력.)

<code>  :  컴퓨터 코드 표시

<samp>  :  컴퓨터 프로그램 샘플 출력 표시

<kbd>  :  키보드 입력 표시

<var>  :  변수 표시

 

 

2. 특수문자 처리

-꺾쇠(<, >)

Life is full of &lt;ups and downs&gt;

결과 → Life is full of <ups and downs>

 

-&(ampersand)

Life is full of ups &amp; downs

결과 → Life is full of ups & downs

 

-스페이스바(spacebar)

Life is full of ups &nbsp;&nbsp;&nbsp;&nbsp; and downs

결과 → Life is full of ups     and downs

 

 

 

3. <pre> 태그

공백이나 특수문자, 줄바꿈 등 사용자가 입력한 그대로 출력할 때

database

 

'수업 > └HTML&CSS' 카테고리의 다른 글

[HTML]<base> 태그  (0) 2022.01.01
[HTML]링크 태그 <a>  (0) 2022.01.01
[HTML]문서 작성할 때  (0) 2022.01.01
[vscode]HTML 기본 구조 자동완성하기  (0) 2022.01.01
[HTML]vscode 기본 구조 및 태그 자동 입력  (0) 2022.01.01
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함