๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Front๐Ÿ‘พ/HTML

HTML tag & attribute ์ •๋ฆฌ

by Jouureee 2020. 11. 23.

HTML์€ ๊ตฌ์กฐ์  ๋ฌธ์„œ์ด๋‹ค. 

 

<HTML> : HTML ๋ฌธ์„œ์˜ ๋ฒ”์œ„๋ฅผ ์„ค์ • 

<html lang="ko">

 

<head> : HTML ๋ฌธ์„œ์˜ ์ •๋ณด๋ฅผ ์„ค์ • 

 

 

<body> : HTML ๋ฌธ์„œ์˜ ๊ตฌ์กฐ๋ฅผ ์„ค์ • 

 

 

<title> : ์ œ๋ชฉ ํ‘œ์‹œ์ค„์ด๋‚˜ ํŽ˜์ด์ง€ ํƒญ์— ๋ณด์ด๋Š” ๋ฌธ์„œ ์ œ๋ชฉ์„ ์ •์˜

 

 

<base> : HTML ๋ฌธ์„œ์— ํฌํ•จ๋œ ๋ชจ๋“  ์ƒ๋Œ€ URL๋“ค์˜ ๊ธฐ์ค€ URL๋ฅผ ์„ค์ •

             ํ•˜๋‚˜์˜ ๋ฌธ์„œ์— ํ•˜๋‚˜์˜ base ํƒœ๊ทธ๋งŒ ์‚ฌ์šฉ ๊ฐ€๋Šฅ 

์†์„ฑ ์˜๋ฏธ  ๊ฐ’ ๊ธฐ๋ณธ ๊ฐ’
href ๊ธฐ์ค€ URL URL X
target A ์š”์†Œ์ฒ˜๋Ÿผ target ์†์„ฑ์„ ์‚ฌ์šฉํ•˜๋Š” ์š”์†Œ์˜ ๊ธฐ๋ณธ๊ฐ’ _self, _blank _self

 

 

<link> : ์™ธ๋ถ€ ๋ฆฌ์†Œ์Šค์˜ ์—ฐ๊ฒฐ ๋ฐ ํ˜„์žฌ ๋ฌธ์„œ์™€์˜ ๊ด€๊ณ„ ๋ช…์‹œ 

<link rel="stylesheet" href="styles.css">
์†์„ฑ ์˜๋ฏธ  ๊ฐ’
rel (ํ•„์ˆ˜!!)
ํ˜„์žฌ ๋ฌธ์„œ์™€ ์™ธ๋ถ€ ๋ฆฌ์†Œ์Šค์™€์˜ ๊ด€๊ณ„
stylesheet, icon…
href ์™ธ๋ถ€ ๋ฆฌ์†Œ์Šค์˜ URL URL
type ์™ธ๋ถ€ ๋ฆฌ์†Œ์Šค์˜ MIME ํƒ€์ž… text/css, image/x-icon…

 

 

<meta> : ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด ์„ค์ •

<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
์†์„ฑ ์˜๋ฏธ  ๊ฐ’
charset ๋ฌธ์ž์ธ์ฝ”๋”ฉ ๋ฐฉ์‹ UTF-8, EUC-KR…
name ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ์˜ ์ด๋ฆ„(์ •๋ณด์˜ ์ข…๋ฅ˜) author, description…
http-equiv ์„œ๋ฒ„/์‚ฌ์šฉ์ž ์—์ด์ „ํŠธ์˜ ์ž‘๋™๋ฐฉ์‹ ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ์ง€์‹œ(HTTP ์‘๋‹ต ํ—ค๋” ์ œ๊ณต) refresh, X-UA-Compatible…
content name, http-equiv์˜ ๊ฐ’  

 

 

<style> : CSS ์ •๋ณด๋ฅผ ์„ค์ •

์†์„ฑ ์˜๋ฏธ  ๊ฐ’
type MIME ํƒ€์ž… text/css

 

 

- For contents - 

<h1>, <h2>, <h3>, <h4>, <h5>, <h6> : ๋ฌธ์„œ ์ •๋ณด ๊ณ„์ธต์„ ๊ตฌ์กฐํ™” 

 

 

<header> : ๋ฌธ์„œ์˜ ํ—ค๋”(๋กœ๊ณ , ์ œ๋ชฉ, ๊ฒ€์ƒ‰ ๋“ฑ ํฌํ•จ)

 

 

<footer> : ๋ฌธ์„œ์˜ ํ’‹ํ„ฐ (์ž‘์„ฑ์ž, ์ €์ž‘๊ถŒ, ๊ด€๋ จ ๋ฌธ์„œ ๋“ฑ ํฌํ•จ)

 

 

<main> : ๋ฌธ์„œ์˜ ๋ฉ”์ธ ์ปจํ…์ธ  

               ํ•˜๋‚˜์˜ ๋ฌธ์„œ์— ํ•˜๋‚˜์˜ main ๋งŒ ํฌํ•จ ๊ฐ€๋Šฅ 

 

 

<article> : ๋…๋ฆฝ์ ์œผ๋กœ ๊ตฌ๋ถ„๋˜๊ฑฐ๋‚˜ ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์˜์—ญ(๋งค๊ฑฐ์ง„, ์‹ ๋ฌธ ๊ธฐ์‚ฌ,๋ธ”๋กœ๊ทธ ๋“ฑ) ์„ ์„ค์ • 

                 h1 ~ h6ํฌํ•จํ•˜์—ฌ ์‹๋ณ„

 

 

<section> : ๋ฌธ์„œ์˜ ์ผ๋ฐ˜์ ์ธ ์˜์—ญ์„ ์„ค์ •

                 h1 ~ h6ํฌํ•จํ•˜์—ฌ ์‹๋ณ„

 

 

<aside> : ๋ฌธ์„œ์˜ ๋ณ„๋„ ์ปจํ…์ธ ๋ฅผ ์„ค์ • (๊ด‘๊ณ ,ใ…ก ๋งํฌ์˜ ์‚ฌ์ด๋“œ๋ฐ” ์„ค์ •)

 

 

<nav> : ๋‹ค๋ฅธ ํŽ˜์ด์ง€ ๋งํฌ ์ œ๊ณตํ•˜๋Š” ์˜์—ญ์„ ์„ค์ • 

 

 

<address> : ์—ฐ๋ฝ์ฒ˜ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ํฌํ•จํ•˜์—ฌ ์‚ฌ์šฉ

 

 

<div> : ๋ณธ์งˆ์ ์œผ๋กœ ์•„๋ฌด๊ฒƒ๋„ ๋‚˜ํƒ€๋‚ด์ง€ ์•Š๋Š” ์ฝ˜ํ…์ธ  ์˜์—ญ์„ ์„ค์ •( division, ๊พธ๋ฏธ๋Š” ๋ชฉ์ ์œผ๋กœ ์‚ฌ์šฉ)

 

 

<ol>, <ul>, <li> : ๊ฐ ํ•ญ๋ชฉ <li>์˜ ์ •๋ ฌ๋œ ๋ชฉ๋ก <ol>(ordered list) ์ด๋‚˜ ์ •๋ ฌ๋˜์ง€ ์•Š๋Š” ๋ชฉ๋ก <ul>(unordered list)์„ ์„ค์ •

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

<ol start="50">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

 

 

<dl>, <dt>, <dd> : (description list, term, description)

<dl>
  <dt>Coffee</dt>
  <dd>Black hot drink</dd>
  <dt>Milk</dt>
  <dd>White cold drink</dd>
</dl>

 

 

<p> : ํ•˜๋‚˜์˜ ๋ฌธ๋‹จ์„ ์„ค์ •

 

 

<hr> :  ๋ฌธ๋‹จ์˜ ๋ถ„๋ฆฌ๋ฅผ ์œ„ํ•œ ๋ง‰๋Œ€๊ธฐ 

 

 

<pre> : ์„œ์‹์ด ์ •ํ•ด์ง„ ํ…์ŠคํŠธ 

 

 

<blockquote> : ๊ธด ์ธ์šฉ๋ฌธ 

<blockquote cite="http://www.worldwildlife.org/who/index.html"> 
For 50 years, WWF has been protecting the future of nature </blockquote>

 

 

<q> : ์งง์€ ์ธ์šฉ๋ฌธ

 

 

<a> : ๋‹ค๋ฅธ ํŽ˜์ด์ง€, ๊ฐ™์€ ํŽ˜์ด์ง€ ์œ„์น˜, ํŒŒ์ผ, ์ด๋ฉ”์ผ ์ฃผ์†Œ, ์ „ํ™”๋ฒˆํ˜ธ ๋“ฑ ๋‹ค๋ฅธ URL๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ํ•˜์ดํผ ๋งํฌ ์„ค์ •

<a href="https://www.w3schools.com">Visit W3Schools.com!</a>

 

์†์„ฑ ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ํŠน์ง•
download ์ด ์š”์†Œ๊ฐ€ ๋ฆฌ์†Œ์Šค๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ์šฉ๋„๋กœ ์‚ฌ์šฉ๋จ์„ ์˜๋ฏธ ๋ถˆ๋ฆฐ(Boolean)  
href ๋งํฌ URL URL ์ƒ๋žต ๊ฐ€๋Šฅ
rel ํ˜„์žฌ ๋ฌธ์„œ์™€ ๋งํฌ URL์˜ ๊ด€๊ณ„(Link Types) license, prev, next…  
target ๋งํฌ URL์˜ ํ‘œ์‹œ(๋ธŒ๋ผ์šฐ์ € ํƒญ) ์œ„์น˜ _self, _blank _self
type ๋งํฌ URL์˜ MIME ํƒ€์ž… text/html…  

 

 

<abbr> : ์•ฝ์–ด๋ฅผ ์ง€์ • 

<p>The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>

 

 

<b> : ์ง„ํ•œ ๊ธ€์”จ

 

 

<mark> : milk์™€ ๊ฐ™์ด ๋งˆํ‚น๋œ ๊ธ€์”จ

 

 

<em> : ์ดํƒค๋ฆญ์ฒด๋กœ ๊ฐ•์กฐ๋œ ๊ธ€์”จ

 

 

<strong> : ์ง„ํ•œ ๊ธ€์”จ

 

 

<dfn> : ์šฉ์–ด๋ฅผ ์ •์˜ํ• ๋•Œ ์‚ฌ์šฉ 

 

 

<cite> : ์ฐฝ์ž‘๋ฌผ์—๋Œ€ํ•œ ์ฐธ์กฐ ์„ค์ •

 

 

<u> : ๋ฐ‘์ค„ ์žˆ๋Š” ๊ธ€์ž ์„ค์ • 

 

 

<del> : ์‚ญ์ œ ์ค„ ์žˆ๋Š” ๊ธ€์ž ์„ค์ • 

 

 

<ins> : ์‚ญ์ œ๋˜๊ณ  ์ถ”๊ฐ€๋œ ๊ธ€์ž ์„ค์ •

 

 

<code> : ์ปดํ“จํ„ฐ ์ฝ”๋“œ ์„ค์ • 

 

 

<kbd> : ํ‚ค๋ณด๋“œ์—์„œ ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ๋‚˜ํƒ€๋‚ด๋Š” ํ…์ŠคํŠธ ๋ฒ”์œ„๋ฅผ ์„ค์ • 

 

 

<sup>, <sub> : ์œ„ ์ฒจ์ž, ์•„๋ž˜ ์ฒจ์ž

 

 

<time> : ์‹œ๊ฐ„ ๋‚˜ํƒ€๋ƒ„

 

 

<span> : ์•„๋ฌด๊ฒƒ๋„ ๋‚˜ํƒ€๋‚ด์ง€ ์•Š๋Š” ์ปจํ…์ธ  ์˜์—ญ์„ ์„ค์ • 

<p>My mother has <span style="color:blue">blue</span> eyes.</p>

 

 

<br /> : ์ค„๋ฐ”๊ฟˆ

 

 

<img> : ์ด๋ฏธ์ง€ ์‚ฝ์ž… 

<img src="img_the_scream.jpg" width="220" height="277" alt="The Scream">
์†์„ฑ ์˜๋ฏธ  ๊ธฐ๋ณธ ๊ฐ’ 
src (ํ•„์ˆ˜)์ด๋ฏธ์ง€ URL URL
alt (ํ•„์ˆ˜)์ด๋ฏธ์ง€์˜ ๋Œ€์ฒดํ…์ŠคํŠธ  
width ์ด๋ฏธ์ง€์˜ ๊ฐ€๋กœ ๋„ˆ๋น„  
height ์ด๋ฏธ์ง€์˜ ์„ธ๋กœ ๋„ˆ๋น„  
srcset ๋ธŒ๋ผ์šฐ์ €์—๊ฒŒ ์ œ์‹œํ•  ์ด๋ฏธ์ง€ URL๊ณผ ์›๋ณธ ํฌ๊ธฐ์˜ ๋ชฉ๋ก์„ ์ •์˜ w, x
sizes ๋ฏธ๋””์–ด ์กฐ๊ฑด๊ณผ ํ•ด๋‹น ์กฐ๊ฑด์ผ ๋•Œ ์ด๋ฏธ์ง€ ์ตœ์ ํ™” ํฌ๊ธฐ์˜ ๋ชฉ๋ก์„ ์ •์˜  

 

 

<audio> : mp3 ์ปจํ…์ธ  ์‚ฝ์ž… 

<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
์†์„ฑ ์˜๋ฏธ  ๊ฐ’ ๊ธฐ๋ณธ ๊ฐ’ 
autoplay ์ค€๋น„๋˜๋ฉด ๋ฐ”๋กœ ์žฌ์ƒ ๋ถˆ๋ฆฐ(Boolean)  
controls ์ œ์–ด ๋ฉ”๋‰ด๋ฅผ ํ‘œ์‹œ ๋ถˆ๋ฆฐ(Boolean)  
loop ์žฌ์ƒ์ด ๋๋‚˜๋ฉด ๋‹ค์‹œ ์ฒ˜์Œ๋ถ€ํ„ฐ ์žฌ์ƒ ๋ถˆ๋ฆฐ(Boolean)  
preload ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ํŒŒ์ผ์„ ๋กœ๋“œํ• ์ง€์˜ ์ง€์ •(ํžŒํŠธ ์ œ๊ณต)

auto: ์ „์ฒด ํŒŒ์ผ ๋กœ๋“œ
metadata
src ์ฝ˜ํ…์ธ  URL URL  
muted ์Œ์†Œ๊ฑฐ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean)  

 

 

<video> : mp4 ์‚ฝ์ž…

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

 

์†์„ฑ ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ ๊ฐ’
autoplay ์ค€๋น„๋˜๋ฉด ๋ฐ”๋กœ ์žฌ์ƒ ๋ถˆ๋ฆฐ(Boolean)  
controls ์ œ์–ด ๋ฉ”๋‰ด๋ฅผ ํ‘œ์‹œ ๋ถˆ๋ฆฐ(Boolean)  
loop ์žฌ์ƒ์ด ๋๋‚˜๋ฉด ๋‹ค์‹œ ์ฒ˜์Œ๋ถ€ํ„ฐ ์žฌ์ƒ ๋ถˆ๋ฆฐ(Boolean)  
muted ์Œ์†Œ๊ฑฐ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean)  
poster ๋™์˜์ƒ ์ธ๋„ค์ผ ์ด๋ฏธ์ง€ URL URL  
preload ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ํŒŒ์ผ์„ ๋กœ๋“œํ• ์ง€์˜ ์ง€์ •(ํžŒํŠธ ์ œ๊ณต)

auto: ์ „์ฒด ํŒŒ์ผ ๋กœ๋“œ
metadata
src ์ฝ˜ํ…์ธ  URL URL  
width ๋™์˜์ƒ ๊ฐ€๋กœ ๋„ˆ๋น„    
height ๋™์˜์ƒ ์„ธ๋กœ ๋„ˆ๋น„    

 

 

<figure>, <figcaption> : ์ด๋ฏธ์ง€ ์‚ฝํ™”๋‚˜ ๋„ํ‘œ

<figure> 
<img src="milk.jpg" alt="A milk"> 
<figcaption>Milk is a nutrient-rich, 
white liquid food produced by the mammary glands of mammals.</figcaption>
</figure>

 

 

<iframe> : ๋‹ค๋ฅธ HTML ํŽ˜์ด์ง€๋ฅผ ํ˜„์žฌ ํŽ˜์ด์ง€์— ์‚ฝ์ž…

<iframe src="https://www.w3schools.com" title="W3Schools Free Online Web Tutorials">
</iframe>

 

์†์„ฑ ์˜๋ฏธ  ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’
name ํ”„๋ ˆ์ž„์˜ ์ด๋ฆ„    
src ํฌํ•จํ•  ๋ฌธ์„œ์˜ URL URL  
width ํ”„๋ ˆ์ž„์˜ ๊ฐ€๋กœ ๋„ˆ๋น„    
height ํ”„๋ ˆ์ž„์˜ ์„ธ๋กœ ๋„ˆ๋น„    
allowfullscreen ์ „์ฒด ํ™”๋ฉด ๋ชจ๋“œ ์‚ฌ์šฉ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean)  
frameborder ํ”„๋ ˆ์ž„ ํ…Œ๋‘๋ฆฌ ์‚ฌ์šฉ ์—ฌ๋ถ€ 0, 1 1
sandbox ๋ณด์•ˆ์„ ์œ„ํ•œ ์ฝ๊ธฐ ์ „์šฉ์œผ๋กœ ์‚ฝ์ž…


allow-same-origin: ๊ฐ™์€ ์ถœ์ฒ˜(๋„๋ฉ”์ธ)์˜ ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ ๊ฐ€๋Šฅ
 

 

 

<canvas> : ์›น ํŽ˜์ด์ง€์— ๊ทธ๋ž˜ํ”ฝ ๊ทธ๋ฆฌ๊ธฐ ์œ„ํ•จ 

์†์„ฑ ์˜๋ฏธ
width ์บ”๋ฒ„์Šค์˜ ๊ฐ€๋กœ ๋„ˆ๋น„
height ์บ”๋ฒ„์Šค์˜ ์„ธ๋กœ ๋„ˆ๋น„

 

<script> : ์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅด๋ฆฌ ๋ฌธ์„œ์— ํฌํ•จํ•˜๊ฑฐ๋‚˜ ์ฐธ์กฐ 

<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script> 

 

์†์„ฑ ์˜๋ฏธ ๊ฐ’ ํŠน์ง•
async ์Šคํฌ๋ฆฝํŠธ์˜ ๋น„๋™๊ธฐ์ (Asynchronously) ์‹คํ–‰ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean) src ์†์„ฑ ํ•„์ˆ˜
defer ๋ฌธ์„œ ํŒŒ์‹ฑ(๊ตฌ๋ฌธ ๋ถ„์„) ํ›„ ์ž‘๋™ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean) src ์†์„ฑ ํ•„์ˆ˜
src ์ฐธ์กฐํ•  ์™ธ๋ถ€ ์Šคํฌ๋ฆฝํŠธ URL URL ํฌํ•จ๋œ ์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋Š” ๋ฌด์‹œ๋จ
type MIME ํƒ€์ž… text/javascript(๊ธฐ๋ณธ๊ฐ’)  

 

<noscript> : ์Šคํฌ๋ฆฝํŠธ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ์‚ฝ์ž…ํ•  HTML ์ •์˜

<noscript>Sorry, your browser does not support JavaScript!</noscript>

 

 

<table>, <tr>, <th>, <td> : ๋ฐ์ดํ„ฐ ํ‘œ(<table>)์˜ ํ–‰(์ค„ / <tr>)๊ณผ ์—ด(์นธ, ์…€(Cell) / <th>, <td>)์„ ์ƒ์„ฑ

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

</body>
</html>

 

 

<caption> : ํ‘œ์— ๋Œ€ํ•œ ์บก์…˜ 

 

 

<colgroup> : ํ‘œ์˜ ์—ด์„ ๊ณตํ†ต์ ์œผ๋กœ ์ •์˜ํ•˜๋Š” ์นผ๋Ÿผ <col> ๊ณผ ๊ทธ์˜ ์ง‘ํ•ฉ <colgroup>

<colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
 </colgroup>

 

 

<thead>, <tbody>, <tfoot> : ํ‘œ์˜ ๋จธ๋ฆฌ๊ธ€(<thead>), ๋ณธ๋ฌธ(<tbody>), ๋ฐ”๋‹ฅ๊ธ€(<tfoot>)์„ ์ง€์ •.

 

 

<form> : ์›น ์„œ๋ฒ„์— ์ •๋ณด ์ œ์ถœํ•˜๊ธฐ ์œ„ํ•œ ์–‘์‹์˜ ๋ฒ”์œ„๋ฅผ ์ •์˜ 

               ๋‹ค๋ฅธ form ์„ ์ž์‹ ์š”์†Œ๋กœ ํฌํ•จํ•  ์ˆ˜ ์—†์Œ

<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Submit">
</form>
์†์„ฑ ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’
action ์ „์†กํ•œ ์ •๋ณด๋ฅผ ์ฒ˜๋ฆฌํ•  ์›นํŽ˜์ด์ง€์˜ URL URL  
autocomplete ์‚ฌ์šฉ์ž๊ฐ€ ์ด์ „์— ์ž…๋ ฅํ•œ ๊ฐ’์œผ๋กœ ์ž๋™ ์™„์„ฑ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€ ์—ฌ๋ถ€ on, off on
method ์„œ๋ฒ„๋กœ ์ „์†กํ•  HTTP ๋ฐฉ์‹ GET, POST GET
name ๊ณ ์œ ํ•œ ์–‘์‹์˜ ์ด๋ฆ„    
novalidate ์„œ๋ฒ„๋กœ ์ „์†ก์‹œ ์–‘์‹ ๋ฐ์ดํ„ฐ์˜ ์œ ํšจ์„ฑ์„ ๊ฒ€์‚ฌํ•˜์ง€ ์•Š๋„๋ก ์ง€์ •    
target ์„œ๋ฒ„๋กœ ์ „์†ก ํ›„ ์‘๋‹ต๋ฐ›์„ ๋ฐฉ์‹์„ ์ง€์ • _self, _blank _self

 

 

<input> : ์‚ฌ์šฉ์ž์—๊ฒŒ ์ž…๋ ฅ ๋ฐ›์„ ๋ฐ์ดํ„ฐ ์–‘์‹

์†์„ฑ  ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’ ํŠน์ง•
autocomplete ์‚ฌ์šฉ์ž๊ฐ€ ์ด์ „์— ์ž…๋ ฅํ•œ ๊ฐ’์œผ๋กœ ์ž๋™ ์™„์„ฑ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€ ์—ฌ๋ถ€ on, off on  
autofocus ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ์ž๋™์œผ๋กœ ํฌ์ปค์Šค ๋ถˆ๋ฆฐ(Boolean)   ๋ฌธ์„œ ๋‚ด ๊ณ ์œ ํ•ด์•ผ ํ•จ
checked ์–‘์‹์ด ์„ ํƒ๋˜์—ˆ์Œ์„ ํ‘œ์‹œ ๋ถˆ๋ฆฐ(Boolean)   type ์†์„ฑ ๊ฐ’์ด radio, checkbox์ผ ๊ฒฝ์šฐ๋งŒ
disabled ์–‘์‹์„ ๋น„ํ™œ์„ฑํ™” ๋ถˆ๋ฆฐ(Boolean)    
form <form>์˜ id ์†์„ฑ ๊ฐ’     ํ•ด๋‹น <form>์˜ ํ›„์†์ด ์•„๋‹ ๊ฒฝ์šฐ๋งŒ
list ์ฐธ์กฐํ•  <datalist>์˜ id ์†์„ฑ ๊ฐ’      
max ์ง€์ • ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ๊ฐ’ ์ˆซ์ž(Number)

min์†์„ฑ๋ณด๋‹ค ํฐ ๊ฐ’๋งŒ ํ—ˆ์šฉ
min ์ง€์ • ๊ฐ€๋Šฅํ•œ ์ตœ์†Œ ๊ฐ’ ์ˆซ์ž(Number)

max์†์„ฑ๋ณด๋‹ค ์ž‘์€ ๊ฐ’๋งŒ ํ—ˆ์šฉ
maxlength ์ž…๋ ฅ ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ๋ฌธ์ž ์ˆ˜ ์ˆซ์ž(Number) 524288 type ์†์„ฑ ๊ฐ’์ด text, email, password, tel, url์ผ ๊ฒฝ์šฐ๋งŒ
multiple ๋‘˜ ์ด์ƒ์˜ ๊ฐ’์„ ์ž…๋ ฅ ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean)

email์ผ ๊ฒฝ์šฐ , ๋กœ ๊ตฌ๋ถ„
name ์–‘์‹์˜ ์ด๋ฆ„      
placeholder ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•  ๊ฐ’์˜ ํžŒํŠธ     type ์†์„ฑ ๊ฐ’์ด text, search, tel, url, email์ผ ๊ฒฝ์šฐ๋งŒ
readonly ์ˆ˜์ • ๋ถˆ๊ฐ€ํ•œ ์ฝ๊ธฐ ์ „์šฉ ๋ถˆ๋ฆฐ(Boolean)    
step ์œ ํšจํ•œ ์ฆ๊ฐ ์ˆซ์ž์˜ ๊ฐ„๊ฒฉ ์ˆซ์ž(Number) 1 type ์†์„ฑ ๊ฐ’์ด number, range์ผ ๊ฒฝ์šฐ๋งŒ
src ์ด๋ฏธ์ง€์˜ URL URL   type ์†์„ฑ ๊ฐ’์ด image์ผ ๊ฒฝ์šฐ๋งŒ
alt ์ด๋ฏธ์ง€์˜ ๋Œ€์ฒด ํ…์ŠคํŠธ     type ์†์„ฑ ๊ฐ’์ด image์ผ ๊ฒฝ์šฐ๋งŒ
type ์ž…๋ ฅ ๋ฐ›์„ ๋ฐ์ดํ„ฐ์˜ ์ข…๋ฅ˜ ๋ณ„๋„ ์ •๋ฆฌ text  
value ์–‘์‹์˜ ์ดˆ๊ธฐ ๊ฐ’      

 

 

- For data type and value - 

<input type="button" />
<input type="checkbox" />
<input type="file" />
<input type="text" />
๋ฐ์ดํ„ฐ ์ข…๋ฅ˜ ํŠน์ง•
button ์ผ๋ฐ˜ ๋ฒ„ํŠผ <button>์ฒ˜๋Ÿผ ์‚ฌ์šฉ
checkbox ์ฒดํฌ๋ฐ•์Šค  
color ์ƒ‰์ƒ IE ์ง€์› ๋ถˆ๊ฐ€
email ์ด๋ฉ”์ผ  
file ํŒŒ์ผ  
hidden ๋ณด์ด์ง€ ์•Š์ง€๋งŒ ์ „์†กํ•  ์–‘์‹ value ์†์„ฑ์œผ๋กœ ๊ฐ’์„ ์ง€์ •
image ์ด๋ฏธ์ง€ ์ œ์ถœ ๋ฒ„ํŠผ <img />์ฒ˜๋Ÿผ ์‚ฌ์šฉ
number ์ˆซ์ž  
password ๋น„๋ฐ€ ๊ฐ€๋ ค์ง€๋Š” ์–‘์‹
radio ๋ผ๋””์˜ค ๋ฒ„ํŠผ ๊ฐ™์€ name ์†์„ฑ ๊ทธ๋ฃน ๋‚ด ํ•˜๋‚˜๋งŒ ์„ ํƒ ๊ฐ€๋Šฅ
range ๋ฒ”์œ„ ์ปจํŠธ๋กค min, max, step, value(๊ธฐ๋ณธ๊ฐ’) ์†์„ฑ ์‚ฌ์šฉ
reset ์ดˆ๊ธฐํ™” ํ•ด๋‹น <form> ๋ฒ”์œ„ ๋‚ด ๋ชจ๋“  ์–‘์‹
search ๊ฒ€์ƒ‰  
submit ์ œ์ถœ ๋ฒ„ํŠผ ํ•ด๋‹น <form> ๋ฒ”์œ„ ๋‚ด ๊ณ ์œ ํ•œ ์–‘์‹
tel ์ „ํ™”๋ฒˆํ˜ธ  
text ์ผ๋ฐ˜ ํ…์ŠคํŠธ  
url ์ ˆ๋Œ€ URL  

 

 

<label> : ๋ผ๋ฒจ ๊ฐ’ 

<form action="/action_page.php">
  <label for="male">Male</label>
  <input type="radio" name="gender" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="gender" id="female" value="female"><br>
  <label for="other">Other</label>
  <input type="radio" name="gender" id="other" value="other"><br><br>
  <input type="submit" value="Submit">
</form>

 

 

<button> : ๋ฒ„ํŠผ ์ง€์ • 

<button type="button" onclick="alert('Hello world!')">Click Me!</button>
์†์„ฑ ์˜๋ฏธ ๊ฐ’ ํŠน์ง•
autofocus ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ์ž๋™์œผ๋กœ ํฌ์ปค์Šค ๋ถˆ๋ฆฐ(Boolean) ๋ฌธ์„œ ๋‚ด ๊ณ ์œ ํ•ด์•ผ ํ•จ
disabled ๋ฒ„ํŠผ์„ ๋น„ํ™œ์„ฑํ™” ๋ถˆ๋ฆฐ(Boolean)  
form <form>์˜ id ์†์„ฑ ๊ฐ’   ํ•ด๋‹น <form>์˜ ํ›„์†์ด ์•„๋‹ ๊ฒฝ์šฐ
name ํผ ๋ฐ์ดํ„ฐ์™€ ํ•จ๊ป˜ ์ „์†ก๋˜๋Š” ๋ฒ„ํŠผ์˜ ์ด๋ฆ„    
type ๋ฒ„ํŠผ์˜ ํƒ€์ž… button, reset, submit  

 

 

<textarea> : ์—ฌ๋Ÿฌ ์ค„์˜ ์ผ๋ฐ˜ ํ…์ŠคํŠธ ์–‘์‹

<textarea id="w3review" name="w3review" rows="4" cols="50">
  At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
  </textarea>
  <br><br>
  <input type="submit" value="Submit">
</form>

 

์†์„ฑ ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ ๊ฐ’  ํŠน์ง•
autocomplete ์‚ฌ์šฉ์ž๊ฐ€ ์ด์ „์— ์ž…๋ ฅํ•œ ๊ฐ’์œผ๋กœ ์ž๋™ ์™„์„ฑ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€ ์—ฌ๋ถ€ on, off on  
autofocus ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ์ž๋™์œผ๋กœ ํฌ์ปค์Šค ๋ถˆ๋ฆฐ(Boolean)   ๋ฌธ์„œ ๋‚ด ๊ณ ์œ ํ•ด์•ผ ํ•จ
disabled ์–‘์‹์„ ๋น„ํ™œ์„ฑํ™” ๋ถˆ๋ฆฐ(Boolean)    
form <form>์˜ id ์†์„ฑ ๊ฐ’     ํ•ด๋‹น <form>์˜ ํ›„์†์ด ์•„๋‹ ๊ฒฝ์šฐ๋งŒ
maxlength ์ž…๋ ฅ ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ๋ฌธ์ž ์ˆ˜ ์ˆซ์ž(Number) ๋ฌดํ•œ  
name ์–‘์‹์˜ ์ด๋ฆ„      
placeholder ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•  ๊ฐ’์˜ ํžŒํŠธ      
readonly ์ˆ˜์ • ๋ถˆ๊ฐ€ํ•œ ์ฝ๊ธฐ ์ „์šฉ ๋ถˆ๋ฆฐ(Boolean)    
rows ์–‘์‹์˜ ์ค„ ์ˆ˜ ์ˆซ์ž(Number) 2  

 

 

<fieldset> : ๊ทธ๋ฃนํ™” 

 

 

<legend> : ์ œ๋ชฉ 

 <fieldset>
  <legend>Personalia:</legend>
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <label for="email">Email:</label>
  <input type="email" id="email" name="email"><br><br>
  <label for="birthday">Birthday:</label>
  <input type="date" id="birthday" name="birthday"><br><br>
  <input type="submit" value="Submit">
 </fieldset>

 

 

<select>, <datalist>, <optgroup>, <option> : ์˜ต์…˜(<option>, <optgroup>)์˜ ์„ ํƒ ๋ฉ”๋‰ด(<select>)๋‚˜ ์ž๋™์™„์„ฑ(<datalist>)์„ ์ œ๊ณต. 

<select>
  <optgroup label="Coffee">
    <option>Americano</option>
    <option>Caffe Mocha</option>
    <option label="Cappuccino" value="Cappuccino"></option>
  </optgroup>
  <optgroup label="Latte" disabled>
    <option>Caffe Latte</option>
    <option>Vanilla Latte</option>
  </optgroup>
  <optgroup label="Smoothie">
    <option>Plain</option>
    <option>Strawberry</option>
    <option>Banana</option>
    <option>Mango</option>
  </optgroup>
</select>

 

 

* <select> --> <optgroup> --> <option>

 

 

 

* <datalist> --> <option> 

 

 

<select> 

์†์„ฑ ์˜๋ฏธ ๊ฐ’ ๊ธฐ๋ณธ๊ฐ’
autocomplete ์‚ฌ์šฉ์ž๊ฐ€ ์ด์ „์— ์ž…๋ ฅํ•œ ๊ฐ’์œผ๋กœ ์ž๋™ ์™„์„ฑ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ธ์ง€ ์—ฌ๋ถ€ on, off on
disabled ์„ ํƒ ๋ฉ”๋‰ด๋ฅผ ๋น„ํ™œ์„ฑํ™” ๋ถˆ๋ฆฐ(Boolean)  
form ์„ ํƒ ๋ฉ”๋‰ด๊ฐ€ ์†ํ•  ํ•˜๋‚˜ ์ด์ƒ์˜ <form>์˜ id ์†์„ฑ ๊ฐ’    
multiple ๋‹ค์ค‘ ์„ ํƒ ์—ฌ๋ถ€ ๋ถˆ๋ฆฐ(Boolean)  
name ์„ ํƒ ๋ฉ”๋‰ด์˜ ์ด๋ฆ„    
       
size ํ•œ ๋ฒˆ์— ๋ณผ ์ˆ˜ ์žˆ๋Š” ํ–‰์˜ ๊ฐœ์ˆ˜ ์ˆซ์ž(Number) 0 (1๊ณผ ๊ฐ™์Œ)

 

 

 

<progress> : ์ž‘์—…์˜ ์™„๋ฃŒ ์†๋„ ๋‚˜ํƒ€๋ƒ„ 

<progress id="file" value="32" max="100"> 32% </progress>

 

 


์ „์—ญ ์†์„ฑ : ๋ชจ๋“  HTML ์š”์†Œ์—์„œ ๊ณตํ†ต์ ์œผ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์†์„ฑ


class : ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ ์š”์†Œ์˜ ๋ณ„์นญ์„ ์ง€์ •, css or javascript ์š”์†Œ ์„ ํƒ๊ธฐ ํ†ตํ•ด ์š”์†Œ ์„ ํƒํ•˜๊ฑฐ๋‚˜ ์ ‘๊ทผ 

id : ๊ณ ์œ ํ•œ ์‹๋ณ„์ž๋ฅผ ์ •์˜, css or javascript ์š”์†Œ ์„ ํƒ๊ธฐ ํ†ตํ•ด ์š”์†Œ ์„ ํƒํ•˜๊ฑฐ๋‚˜ ์ ‘๊ทผ 

style: ์š”์†Œ์— ์ ์šฉํ•  css ๋ฅผ ์„ ์–ธ 

tytle: ์š”์†Œ์˜ ์ •๋ณด๋ฅผ ์„ค์ • 

lang : ์š”์†Œ์˜ ์–ธ์–ด๋ฅผ ์ง€์ • 

data-* : ์‚ฌ์šฉ์ž ์ •์˜ ๋ฐ์ดํ„ฐ ์†์„ฑ์„ ์ง€์ • 

draggable: ์š”์†Œ๊ฐ€ ๋“œ๋ž˜๊ทธ์•ค๋“œ๋กญ ๊ฐ€๋Šฅํ•œ์ง€ ์—ฌ๋ถ€๋ฅผ ์ง€์ • 

hidden : ์š”์†Œ๋ฅผ ์ˆจ๊น€ 

tanindex:tab ํ‚ค ์ด์šฉํ•ด ์ˆœ์ฐจ์ ์œผ๋กœ ํฌ์ปค์Šค ํƒ์ƒ‰ํ• ์ˆœ์„œ๋ฅผ ์ง€์ • 

<template> : ๋ Œ๋”๋ง ๋˜์ง€ ์•Š์€ ์ปจํ…์ธ  ๋ณด์œ 

<map>, <area> : ์ด๋ฏธ์ง€๋งต : ์„ ํƒ๊ฐ€๋Šฅํ•œ ์ง€์—ญ์˜ ์ด๋ฏธ์ง€ ์ •์˜ <img /> ์™€ ์—ฐ๊ฒฐํ•˜์—ฌ ์‚ฌ์šฉ 

<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>

<picture> : ์ด๋ฏธ์ง€ ์‚ฝ์ž…, <img /> ๋กœ ๋Œ€์ฒด ๊ฐ€๋Šฅ 

<source> : ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์„ ํƒ ๊ฐ€๋Šฅํ•œ <audio>, <video>, <picture>๋“ฑ์˜ ๋‹ค์ค‘ ๋ฏธ๋””์–ด ๋ฆฌ์†Œ์Šค๋ฅผ ์ง€์ •.

<track> : <audio>, <video> ๊ฐ™์€ ๋ฏธ๋””์–ด๊ฐ€ ์žฌ์ƒ ์ค‘์ผ ๋•Œ ํ‘œ์‹œ๋  ์ž๋ง‰, ์บก์…˜ ํŒŒ์ผ ๋“ฑ์„ ์ง€์ •.

<embed> : ์™ธ๋ถ€ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ๋Œ€ํ™”ํ˜• ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฝ์ž….

<object> : ๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด, ์ค‘์ฒฉ๋œ ๋ธŒ๋ผ์šฐ์ € ์ปจํ…์ŠคํŠธ(ํ”„๋ ˆ์ž„), ํ”Œ๋Ÿฌ๊ทธ์ธ ๋“ฑ์„ ์‚ฝ์ž…

<param> : <object>์˜ ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์ •์˜

 

 

 

์ธ์šฉ ์ถœ์ฒ˜ : 

heropy.blog/2019/05/26/html-elements

 

ํ•œ๋ˆˆ์— ๋ณด๋Š” HTML ์š”์†Œ(Elements & Attributes) ์ด์ •๋ฆฌ

์ธํ„ฐ๋„ท์— ๊ฒ€์ƒ‰ ๊ฐ€๋Šฅํ•œ ๋งŽ์€ HTML ๋ฌธ์„œ๋“ค์˜ ๋‚ด์šฉ์„ ์š”์†Œ(Elements), ์†์„ฑ(Attributes)์˜ ๊ฐœ๋…์œผ๋กœ ํ•ต์‹ฌ์ ์ธ ๋‚ด์šฉ๋“ค๋งŒ ์š”์•ฝํ•ด์„œ ์ •๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ์š”์†Œ๋“ค์˜ ์ž์„ธํ•œ ์„ค๋ช…์€ ํŒจ์ŠคํŠธ์บ ํผ์Šค ์˜จ๋ผ์ธ ๊ฐ•์˜(online

heropy.blog

๋Œ“๊ธ€