Client/HTML

[HTML] HTML ์ด๋ฏธ์ง€, ๋™์˜์ƒ(์œ ํŠœ๋ธŒ), ์Œ์•… ๋„ฃ๋Š” ๋ฒ•

meeeeejin 2021. 4. 28. 09:44

๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด์™€ ๊ด€๋ จ๋œ ํƒœ๊ทธ

 

โœ” ์ด๋ฏธ์ง€(image) ๋„ฃ๊ธฐ

html ๋ฌธ์„œ์— ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์œผ๋ ค๋ฉด <img> ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. <img> ํƒœ๊ทธ๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค. ์ด ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์œผ๋ฉด, ์ด๋ฏธ์ง€๊ฐ€ html ๋ฌธ์„œ์— ์ง์ ‘ ์‚ฝ์ž…๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์ด๋ฏธ์ง€ ์ฃผ์†Œ๊ฐ€ ๋งํฌ๋˜๋Š” ํ˜•ํƒœ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ <img> ํƒœ๊ทธ์—๋Š” src์™€ alt ์†์„ฑ์„ ๋ฐ˜๋“œ์‹œ ๋ช…์‹œํ•ด ์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. 

  • src: source, ์†์„ฑ ๊ฐ’์œผ๋กœ ์ด๋ฏธ์ง€์˜ URL์„ ๋ฐ›์Šต๋‹ˆ๋‹ค. 
  • alt: alternative text, ์†์„ฑ ๊ฐ’์œผ๋กœ ์‚ฌ์ง„ ์„ค๋ช…์„ ๋ฐ›๊ณ , ์ด ์„ค๋ช…์€ ๋ถˆ๋Ÿฌ์˜ฌ ์ด๋ฏธ์ง€๊ฐ€ ์—†๊ฑฐ๋‚˜ ์ด๋ฏธ์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ ๋Œ€์‹  ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค. 
<img 
	src="https://item.kakaocdn.net/do/a1866850b14ae47d0a2fd61f409dfc057154249a3890514a43687a85e6b6cc82" 
    alt="๋ฃจํ”ผ ์‚ฌ์ง„"
    width="30%" height="30%" 
>

 

 

โœ” ์˜์ƒ(video) ๋„ฃ๊ธฐ

1. <video> ํƒœ๊ทธ ์ด์šฉ

์˜์ƒ์€ <video> ํƒœ๊ทธ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. <video> ํƒœ๊ทธ๋Š” ๋ฌด๋น„ ํด๋ฆฝ(movie clip)์ด๋‚˜ ๋น„๋””์˜ค ์ŠคํŠธ๋ฆผ(video stram)๊ณผ ๊ฐ™์€ ๋น„๋””์˜ค๋ฅผ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ MP4, WebM, Ogg ํฌ๋งท์˜ ํŒŒ์ผ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. 

 

์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

์†์„ฑ ์†์„ฑ๊ฐ’ ์„ค๋ช…
autoplay autoplay ๋น„๋””์˜ค ์ž๋™ ์‹คํ–‰
controls controls ํ”Œ๋ ˆ์ด๋‚˜ ์ •์ง€ ๋ฒ„ํŠผ ๋“ฑ ๋น„๋””์˜ค ์‹คํ–‰ ์ œ์–ด๊ธฐ ํ‘œ์‹œ
height ํ”ฝ์…€ ๋น„๋””์˜ค์˜ ๋†’์ด
width ํ”ฝ์…€ ๋น„๋””์˜ค์˜ ๋„ˆ๋น„
loop loop ๋น„๋””์˜ค ์žฌ์ƒ์ด ๋๋‚˜๋ฉด ๋‹ค์‹œ ์žฌ์ƒ(๋ฐ˜๋ณต ์žฌ์ƒ)
muted muted ๋น„๋””์˜ค ์Œ์†Œ๊ฑฐ(์†Œ๋ฆฌ ์ถœ๋ ฅX)
poster URL ๋น„๋””์˜ค๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ๋™์•ˆ์ด๋‚˜ ์‚ฌ์šฉ์ž๊ฐ€ ์žฌ์ƒ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅผ ๋•Œ๊นŒ์ง€ ํ‘œ์‹œํ•  ์ด๋ฏธ์ง€ URL
preload auto
metadata
none
ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ์˜ค๋””์˜ค ํŒŒ์ผ์ด ๊ฐ™์ด ๋กœ๋“œ์™ธ์–ด์•ผ ํ•˜๋Š”์ง€ ์—ฌ๋ถ€์™€ ๊ทธ ๋ฐฉ๋ฒ•
src URL ๋น„๋””์˜ค ํŒŒ์ผ์˜ ์œ„์น˜(URL)
<video height="180" width="288" controls>
    <source src="/examples/media/sample_video_ogg.ogg" type="video/ogg">
    <source src="/examples/media/sample_video_mp4.mp4" type="video/mp4">
    ๋ธŒ๋ผ์šฐ์ €๊ฐ€ video ํƒœ๊ทธ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์„ ๋•Œ ํ‘œ์‹œ๋˜๋Š” ๋ฌธ์žฅ
</video>

 

 

 

 

2. ์œ ํŠœ๋ธŒ ์˜์ƒ ํผ์˜ค๊ธฐ

์œ ํŠœ๋ธŒ ์˜์ƒ์„ html ๋ฌธ์„œ์— ์‚ฝ์ž…ํ•˜๊ณ  ์‹ถ์„ ๊ฒฝ์šฐ, ์šฐ์„  ์›ํ•˜๋Š” ์œ ํŠœ๋ธŒ ์˜์ƒ์„ ์ฐพ์Šต๋‹ˆ๋‹ค. 

 

1) ์˜์ƒ ์•„๋ž˜์ชฝ์— ๊ณต์œ  ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. 

2) ๊ณต์œ  ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๋‚˜์˜ค๋Š” ์ฐฝ์—์„œ ํผ๊ฐ€๊ธฐ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. 

3) ๋‹ค์Œ๊ณผ ๊ฐ™์ด <ifram> ํƒœ๊ทธ๊ฐ€ ํฌํ•จ๋œ ์ฝ”๋“œ๋ฅผ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. 

4) ๋ณต์‚ฌํ•œ ์ฝ”๋“œ๋ฅผ html ํŒŒ์ผ์—์„œ ์˜์ƒ์„ ๋„ฃ๊ณ  ์‹ถ์€ ๋ถ€๋ถ„์— ๋ถ™์—ฌ ๋„ฃ์Šต๋‹ˆ๋‹ค. 

 

 

 

โœ” ์˜ค๋””์˜ค(audio) ๋„ฃ๊ธฐ

์˜ค๋””์˜ค์€ <audio> ํƒœ๊ทธ๋ฅผ ์ด์šฉํ•˜์—ฌ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. <audio> ํƒœ๊ทธ๋Š” ์Œ์•…์ด๋‚˜ ์˜ค๋””์˜ค ์ŠคํŠธ๋ฆผ๊ณผ ๊ฐ™์€ ์‚ฌ์šด๋“œ๋ฅผ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ MP3, WAV, Ogg ํฌ๋งท์˜ ํŒŒ์ผ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. 

 

์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

์†์„ฑ ์†์„ฑ๊ฐ’ ์„ค๋ช…
autoplay autoplay ์˜ค๋””์˜ค ์ž๋™ ์‹คํ–‰
controls controls ํ”Œ๋ ˆ์ด๋‚˜ ์ •์ง€ ๋ฒ„ํŠผ ๋“ฑ ์˜ค๋””์˜ค ์‹คํ–‰ ์ œ์–ด๊ธฐ ํ‘œ์‹œ
loop loop ์˜ค๋””์˜ค ์žฌ์ƒ์ด ๋๋‚˜๋ฉด ๋‹ค์‹œ ์žฌ์ƒ(๋ฐ˜๋ณต ์žฌ์ƒ)
muted muted ์˜ค๋””์˜ค ์Œ์†Œ๊ฑฐ(์†Œ๋ฆฌ ์ถœ๋ ฅX)
preload auto
metadata
none
ํŽ˜์ด์ง€๊ฐ€ ๋กœ๋“œ๋  ๋•Œ ์˜ค๋””์˜ค ํŒŒ์ผ์ด ๊ฐ™์ด ๋กœ๋“œ์™ธ์–ด์•ผ ํ•˜๋Š”์ง€ ์—ฌ๋ถ€์™€ ๊ทธ ๋ฐฉ๋ฒ•
src URL ์˜ค๋””์˜ค ํŒŒ์ผ์˜ ์œ„์น˜(URL)
<audio 
    controls
    src="/audio/Dolphin-์˜ค๋งˆ์ด๊ฑธ(OH MY GIRL) -.mp3" 
    type="audio/mpeg"
>
    ๋ธŒ๋ผ์šฐ์ €๊ฐ€ audio ํƒœ๊ทธ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์„ ๋•Œ ํ‘œ์‹œ๋˜๋Š” ๋ฌธ์žฅ
</audio>

 

 

โœ” ์‚ฌ์šฉ ์˜ˆ์‹œ

<!DOCTYPE html>
<html lang="kr">
<head>
    <meta charset="UTF-8">
    <title>๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด์™€ ๊ด€๋ จ๋œ ํƒœ๊ทธ</title>
</head>
<body>
    <!--image-->
    <img 
    	src="https://item.kakaocdn.net/do/a1866850b14ae47d0a2fd61f409dfc057154249a3890514a43687a85e6b6cc82" 
        alt="๋ฃจํ”ผ ์‚ฌ์ง„"
        width="30%" height="30%" 
    >
    <!--youtube-->
    <iframe 
        width="500" height="255" 
        src="https://www.youtube.com/embed/b6nCWvzVbH0" 
        title="YouTube video player" 
        frameborder="0" 
        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
        allowfullscreen>
    </iframe>

    <!--audio-->
    <audio 
        controls
        src="/audio/Dolphin-์˜ค๋งˆ์ด๊ฑธ(OH MY GIRL) -.mp3" 
        type="audio/mpeg"
    >
        ๋ธŒ๋ผ์šฐ์ €๊ฐ€ audio ํƒœ๊ทธ๋ฅผ ์ง€์›ํ•˜์ง€ ์•Š์„ ๋•Œ ํ‘œ์‹œ๋˜๋Š” ๋ฌธ์žฅ
    </audio>
</body>
</html>

 

 

 

 

 

์ฐธ๊ณ  ์‚ฌ์ดํŠธ:

tcpschool.com/html-tags/video

tcpschool.com/html-tags/audio

728x90