Search

λ ˆμ΄μ•„μ›ƒ νƒœκ·Έ

λ ˆμ΄μ•„μ›ƒ νƒœκ·Έ

μ›Ή νŽ˜μ΄μ§€μ˜ λ ˆμ΄μ•„μ›ƒμ„ κ΅¬μ„±ν•˜κ³  μŠ€νƒ€μΌμ„ μ μš©ν•˜λŠ” 데 μ‚¬μš©λ˜λŠ” νƒœκ·Έμž…λ‹ˆλ‹€.
κ΄€λ‘€μ μœΌλ‘œ 블둝 μš”μ†Œμ˜ νŠΉμ§•μ„ 가진 div νƒœκ·Έμ™€ 인라인 μš”μ†ŒμΈ span νƒœκ·Έκ°€ λ ˆμ΄μ•„μ›ƒ νƒœκ·Έλ‘œ 많이 μ‚¬μš©λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
νƒœκ·Έ
μ„€λͺ…
νŠΉμ„±
<div>
곡간(μ˜μ—­)을 λ‚˜λˆ„κΈ° μœ„ν•΄ μ‚¬μš©ν•˜λŠ” νƒœκ·Έ. νŽ˜μ΄μ§€λ₯Ό 논리적인 μ˜μ—­μœΌλ‘œ 뢄리.
- 블둝 μš”μ†Œ - μƒμœ„ μ˜μ—­μ˜ 전체 λ„ˆλΉ„λ₯Ό 차지
<span>
μš”μ†Œμ˜ λ‚΄μš©μ΄ ν•„μš”ν•œ 크기만 μ°¨μ§€ν•˜λŠ” νƒœκ·Έ. λ””μžμΈμ μœΌλ‘œ ꡬ뢄이 ν•„μš”ν•œ μš”μ†Œλ₯Ό 지정.
- 인라인 μš”μ†Œ - λ‹€λ₯Έ μš”μ†Œμ™€ ν•œ 쀄에 λ‚˜λž€νžˆ 배치
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>div & span</title> </head> <body> <h1>곡간 λΆ„ν•  νƒœκ·Έ</h1> <!-- div (divide) : λ‚˜λˆ„λ‹€ - "곡간(μ˜μ—­)을 λ‚˜λˆ„λ‹€" : νŽ˜μ΄μ§€λ₯Ό 논리적인 μ˜μ—­μœΌλ‘œ λΆ„λ¦¬ν•˜κΈ° μœ„ν•΄ μ‚¬μš©ν•˜λŠ” νƒœκ·Έ - block μš”μ†Œ (μƒμœ„μ˜μ—­μ˜ 전체 λ„ˆλΉ„λ₯Ό μ°¨μ§€ν•˜λŠ” μš”μ†Œ) --> <h2>div μš”μ†Œ</h2> <div style="border: 2px solid blue;"> <h2>HTML</h2> <p>HyperText Markup Language</p> </div> <hr> <!-- span : μš”μ†Œμ˜ λ‚΄μš©μ΄ ν•„μš”ν•œ 크기만 μ°¨μ§€ν•˜λŠ” νƒœκ·Έ - λ””μžμΈμ μœΌλ‘œ ꡬ뢄이 ν•„μš”ν•œ μš”μ†Œλ₯Ό 지정할 λ•Œ μ‚¬μš© - inline μš”μ†Œ (λ‹€λ₯Έ μš”μ†Œμ™€ ν•œ 쀄에 λ‚˜λž€νžˆ λ°°μΉ˜λ˜λŠ” μš”μ†Œ) --> <h2>span μš”μ†Œ</h2> <div style="border: 2px solid red;"> <h2>CSS</h2> <p> Cascading <span style="color: red; background-color: yellow;">Style</span> Sheets </p> </div> </body> </html>
HTML
볡사
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>div λ ˆμ΄μ•„μ›ƒ</title> <style> /* (μ„ νƒμž) { μŠ€νƒ€μΌ 속성 : 속성값; } */ * { margin: 0; padding: 0; box-sizing: border-box; } /* 헀더 μ˜μ—­ */ .header { background-color: #f1f1f1; padding: 36px; text-align: center; font-size: 24px; } /* 메인 μ˜μ—­ */ .left-side { float: left; background-color: #aaa; width: 25%; padding: 10px; height: 300px; } .main { float: left; background-color: #bbb; width: 50%; padding: 10px; height: 300px; } .right-side { float: left; padding: 10px; width: 25%; background-color: #ccc; height: 300px; } .footer { background-color: black; padding: 10px; text-align: center; color: white; line-height: 100px; } </style> </head> <body> <h1>div λ ˆμ΄μ•„μ›ƒ</h1> <!-- .header>h2{헀더 μ˜μ—­} --> <div class="header"> <h2>헀더 μ˜μ—­</h2> </div> <!-- .container>(.left-side{μ™Όμͺ½}+.main{메인}+.right-side{였λ₯Έμͺ½}) --> <div class="container"> <div class="left-side">μ™Όμͺ½</div> <div class="main">메인</div> <div class="right-side">였λ₯Έμͺ½</div> </div> <!-- .footer>p{ν‘Έν„° μ˜μ—­} --> <div class="footer"> <p>ν‘Έν„° μ˜μ—­</p> </div> </body> </html>
HTML
볡사