κ°œμΈκ³΅λΆ€/HTML5 + CSS3

[HTML+CSS] [ν…μŠ€νŠΈ κ΄€λ ¨ νƒœκ·Έ] 04 - ν‘œλ₯Ό λ§Œλ“œλŠ” νƒœκ·Έ

πŸ‡λ°•λ΄‰λ΄‰πŸ‡ 2020. 6. 10. 15:00

 

 

[HTML+CSS] [ν…μŠ€νŠΈ κ΄€λ ¨ νƒœκ·Έ] 03 - λͺ©λ‘μ„ λ§Œλ“œλŠ” νƒœκ·Έ

[HTML+CSS] [ν…μŠ€νŠΈ κ΄€λ ¨ νƒœκ·Έ] 02 - 인라인 레벨 νƒœκ·Έ [HTML+CSS] [ν…μŠ€νŠΈ κ΄€λ ¨ νƒœκ·Έ] 01 - 블둝 레벨 νƒœκ·Έ [HTML+CSS] [HTML κΈ°λ³Έ 닀지기] 05 - μ—”ν‹°ν‹° 기호 μ‚¬μš©ν•˜κΈ° [HTML+CSS] [HTML κΈ°λ³Έ 닀지기] 04 - HTML..

onelight-stay.tistory.com

 

λ‚΄μš©μ„ κΉ”λ”ν•˜κ²Œ ν‘œμ‹œν•  수 μžˆλŠ”

ν‘œλ₯Ό λ§Œλ“œλŠ” νƒœκ·Έμ— λŒ€ν•΄μ„œ μ•Œμ•„λ³΄μž.

 

 


 

 

<table>, <tr>, <td>, <th> - 기본적인 ν‘œ

 

<table>은 ν…Œμ΄λΈ” 전체 μœ€κ³½μ„ μž‘μ•„μ£Όκ³ 

이 μ•ˆμ—μ„œ 행을 λ§Œλ“œλŠ” <tr>κ³Ό 열을 λ§Œλ“œλŠ” <td>둜 κ΅¬μ„±λ˜μ–΄ μžˆλ‹€.

 

λ˜ν•œ <th>λŠ” <td>λŒ€μ‹ μ— μ‚¬μš©ν•  수 μžˆλŠ”λ° 셀에 제λͺ©μ„ 넣을 λ•Œ μ‚¬μš©λ˜λ©°

<td>μ™€λŠ” 달리 μ…€ μ•ˆμ˜ λ‚΄μš©μ„ μ€‘μ•™μœΌλ‘œ λ°°μΉ˜μ‹œν‚€κ³  글꼴을 ꡡ게 λ§Œλ“€μ–΄ μ€€λ‹€.

 

 

- colspan, rowspan 속성 -

 

<table> νƒœκ·Έμ—μ„œμ™€ <th>μ—μ„œ μ‚¬μš© ν•  수 μžˆλŠ” μ†μ„±μœΌλ‘œ

각자 μ—΄κ³Ό 행을 ν•©μΉ  수 μžˆλŠ” 속성이닀.

 

 

-aria-describedby 속성

 

ν‘œμ— 이해λ₯Ό 높이기 μœ„ν•΄ μ„€λͺ…문을 μž‘μ„±ν•˜κ³  싢을 λ•Œ μ‚¬μš©λ˜λ©°,

ν…Œμ΄λΈ” νƒœκ·Έ λ°–μ—μ„œ idλ₯Ό λ§Œλ“€μ–΄ λ‚΄μš©μ„ μž‘μ„±ν•œ 뒀에

ν…Œμ΄λΈ” νƒœκ·Έ μ˜†μ— ν•΄λ‹Ή 속성을 μ΄μš©ν•΄ 전에 λ§Œλ“  id와 μ—°κ²° μ‹œν‚€λ©΄ λ‚΄μš©μ΄ μ—°κ²°λ˜μ–΄

ν‘œμ™€ ν•¨κ»˜ 화면에 λ‚˜νƒ€λ‚œλ‹€.

 

 

<caption>, <figcaption> - ν‘œμ— 제λͺ© 뢙이기

 

<caption>와 <figcaption> λ‘˜λ‹€ ν‘œμ— 제λͺ©μ„ λΆ™μ΄λŠ”λ°μ— μ‚¬μš©λ˜μ§€λ§Œ 각자 차이점이 μžˆλ‹€.

 

<caption>을 μ‚¬μš©ν•  λ•Œ <table><table> νƒœκ·Έ λ°”λ‘œ λ‹€μŒμ— μ‚¬μš©ν•΄μ•Ό ν•˜λ©°,

 μ‚¬μš©ν–ˆμ„ 경우 ν‘œ μœ„μ— 쀑앙에 제λͺ©μ΄ λ‚˜νƒ€λ‚œλ‹€.

 

 

<figcaption>은 μ„€λͺ… 글을 뢙이고 싢은 λŒ€μƒμ„ <figure>둜 감싼 뒀에

<figcaption> μ•ˆμ—.

 

μ΄λ•Œ, <table> νƒœκ·Έ 밖에 μ‚¬μš©ν•΄μ•Ό ν•˜λ©° μ‚¬μš©ν–ˆμ„ 경우

<caption>κ³ΌλŠ” 달리 쀑앙에 λ‚΄μš©μ΄ λ‚˜νƒ€λ‚˜μ§€ μ•ŠλŠ”λ‹€.

 

 

<thead>, <tbody>, <tfoot> - ν‘œ ꡬ쑰 μ •μ˜

 

ν‘œλ₯Ό 제λͺ©(head), λ³Έλ¬Έ(body), μš”μ•½(foot) λΆ€λΆ„μœΌλ‘œ

ν‘œμ˜ ꡬ쑰λ₯Ό μ •μ˜ν•΄μ„œ ν‘œλ₯Ό μž‘μ„±ν•˜λŠ” 것이닀.

 

ν•΄λ‹Ή ν‘œλ₯Ό μ •μ˜ν•˜μ˜€μ„ 경우 μ‹œκ°μž₯애인듀도 ν™”λ©΄ 낭독기λ₯Ό 톡해 ν‘œμ˜ ꡬ쑰λ₯Ό μ‰½κ²Œ 이해할 수 μžˆλ‹€.

 

 

<col>, <colgroup> - μ—¬λŸ¬ μ—΄ λ¬Άμ–΄ μŠ€νƒ€μΌ 지정

 

<col>은 ν•œ 열에 μžˆλŠ” λͺ¨λ“  셀에 같은 μŠ€νƒ€μΌμ„ μ μš©μ‹œν‚€λŠ” κ²ƒμœΌλ‘œ λ‹«λŠ” νƒœκ·Έκ°€ μ—†μœΌλ©°

λ˜ν•œ, span 속성을 μ΄μš©ν•΄ λ‘˜ μ΄μƒμ˜ 열을 λ¬Άμ–΄ 같은 μŠ€νƒ€μΌλ‘œ 지정해 쀄 수 μžˆλ‹€.

 

<colgroup>은 μ—¬λŸ¬ 열을 λ¬Άμ–΄ μŠ€νƒ€μΌμ„ μ μš©ν•˜λŠ” 데 μ‚¬μš©λœλ‹€.

ν•΄λ‹Ή νƒœκ·Έλ“€μ€ <caption><caption> νƒœκ·Έ λ’€ <tr>,<td> νƒœκ·Έ 전에 μ‚¬μš©ν•΄μ•Ό ν•œλ‹€.

 

 


 

 

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ν‘œλ₯Ό λ§Œλ“œλŠ” νƒœκ·Έ</title>
    <style>
    table { 
        
        border: 1px solid black;
        border-collapse: collapse;
     }
     th, td {
         border: 1px solid black;
     }
     thead, tfoot {
         background-color: lightgray;
     }
     </style>
</head>
<body>
    <h1>2*3ν‘œ λ§Œλ“€κΈ°</h1>
    <table>
        <tr>
            <th>제λͺ© μ…€</th>
            <td>1ν–‰ 2μ—΄</td>
            <td>1ν–‰ 3μ—΄</td>
        </tr>
        <tr>
            <th>제λͺ© μ…€</th>
            <td>2ν–‰ 2μ—΄</td>
            <td>2ν–‰ 3μ—΄</td>
        </tr>
    </table>
    <br>
    <hr>
    <h1>일뢀 μ…€ ν•©μΉ˜κΈ°</h1>
    <table>
        <tr>
            <th>이름</th>
            <td>홍길동</td>
            <th>μ—°λ½μ²˜</th>
            <td>010-1234-5678</td>
        </tr>
        <tr>
            <th>μ£Όμ†Œ</th>
            <td colspan="3">ν•œμ–‘</td>
        </tr>
        <tr>
            <th>μžκΈ°μ†Œκ°œ</th>
            <td colspan="3">λ™ν•΄λ²ˆμ©! μ„œν•΄λ²ˆμ©!</td>
        </tr>
    </table>
    <br>
    <hr>
    <h1>ν‘œμ— 제λͺ© 뢙이기1</h1>
    <table>
        <caption>
            <strong>Modern Browser</strong><br>
            <p>κ΅­λ‚΄μ—μ„œ 자주 μ‚¬μš©ν•˜λŠ” λͺ¨λ˜ λΈŒλΌμš°μ €</p>
        </caption>
        <tr>
            <th>λΈŒλΌμš°μ €</th>
            <th>μ œμ‘°μ—…μ²΄</th>
            <th>λ‹€μš΄λ‘œλ“œ</th>
        </tr>
        <tr>
            <td>크둬(Chrome)</td>
            <td>Google</td>
            <td>https://www.google.com/chrome</td>
        </tr>
        <tr>
            <td>νŒŒμ΄μ–΄ν­μŠ€(Firefox)</td>
            <td>Mozilla</td>
            <td>https://www.mozilla.org/ko/firefox</td>
        </tr>
        <tr>
            <td>엣지(Edge)</td>
            <td>Microsoft</td>
            <td>https://www.microsoft.com/ko-kr/windows/microsoft-edge</td>
        </tr>
    </table>
    <br>
    <hr>
    <h1>ν‘œμ— 제λͺ© 뢙이기2</h1>
    <figure>
        <figcaption>
            <p>κ΅­λ‚΄μ—μ„œ 자주 μ‚¬μš©ν•˜λŠ” <b>λͺ¨λ˜ λΈŒλΌμš°μ €</b></p>
        </figcaption>
    <table>
        <tr>
            <th>λΈŒλΌμš°μ €</th>
            <th>μ œμ‘°μ—…μ²΄</th>
            <th>λ‹€μš΄λ‘œλ“œ</th>
        </tr>
        <tr>
            <td>크둬(Chrome)</td>
            <td>Google</td>
            <td>https://www.google.com/chrome</td>
        </tr>
        <tr>
            <td>νŒŒμ΄μ–΄ν­μŠ€(Firefox)</td>
            <td>Mozilla</td>
            <td>https://www.mozilla.org/ko/firefox</td>
        </tr>
        <tr>
            <td>엣지(Edge)</td>
            <td>Microsoft</td>
            <td>https://www.microsoft.com/ko-kr/windows/microsoft-edge</td>
        </tr>
    </table>
    </figure>
    <br>
    <hr>
    <h1>ν™”λ©΄ 낭독기λ₯Ό μœ„ν•œ ν‘œ μ„€λͺ… μ œκ³΅ν•˜κΈ°</h1>
    <p id="summary">λ‹€μŒ ν‘œλŠ” HTML5λ₯Ό μ§€μ›ν•˜λŠ” λͺ¨λ˜ λΈŒλΌμš°μ €(Modern Browser)λ₯Ό μ •λ¦¬ν•œ κ²ƒμž…λ‹ˆλ‹€. 
    μ΅œμ‹  λ²„μ „μΌμˆ˜λ‘ HTML5λ₯Ό μ’€ 더 많이 μ§€μ›ν•˜κΈ° λ•Œλ¬Έμ— μ΅œμ‹  버전을 λ‹€μš΄λ‘œλ“œν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.</p>
    <table aria-describedby="summary">
        <tr>
            <th>λΈŒλΌμš°μ €</th>
            <th>μ œμ‘°μ—…μ²΄</th>
            <th>λ‹€μš΄λ‘œλ“œ</th>
        </tr>
        <tr>
            <td>크둬(Chrome)</td>
            <td>Google</td>
            <td>https://www.google.com/chrome</td>
        </tr>
        <tr>
            <td>νŒŒμ΄μ–΄ν­μŠ€(Firefox)</td>
            <td>Mozilla</td>
            <td>https://www.mozilla.org/ko/firefox</td>
        </tr>
        <tr>
            <td>엣지(Edge)</td>
            <td>Microsoft</td>
            <td>https://www.microsoft.com/ko-kr/windows/microsoft-edge</td>
        </tr>
    </table>
    <br>
    <hr>
    <h1>ν‘œ κ΅¬μ‘°ν™”ν•˜κΈ°</h1>
    <table>
        <caption>μ œμ£ΌνŠΉλ³„μžμΉ˜λ„ ν•™κ΅ν˜„ν™©(2015.4.1 κΈ°μ€€)</caption>
        <thead>
            <tr>
                <th>ꡬ λΆ„</th>
                <th>ν•™ ꡐ 수</th>
                <th>ν•™ κΈ‰ 수</th>
                <th>ν•™ 생 수</th>
                <th>ꡐ 원 수</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th>μœ μΉ˜μ›</th>
                <td>117</td>
                <td>252</td>
                <td>5,547</td>
                <td>474</td>
            </tr>
            <tr>
                <th>μ΄ˆλ“±ν•™κ΅</th>
                <td>111</td>
                <td>1,720</td>
                <td>37,686</td>
                <td>2,632</td>
            </tr>
            <tr>
                <th>쀑학ꡐ</th>
                <td>44</td>
                <td>699</td>
                <td>21,274</td>
                <td>1,412</td>
            </tr>
            <tr>
                <th>고등학ꡐ</th>
                <td>29</td>
                <td>676</td>
                <td>22,019</td>
                <td>1,433</td>
            </tr>
            <tr>
                <th>νŠΉμˆ˜ν•™κ΅</th>
                <td>3</td>
                <td>90</td>
                <td>428</td>
                <td>160</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <th>합계</th>
                <td>300</td>
                <td>3,437</td>
                <td>86,954</td>
                <td>6,111</td>
            </tr>
        </tfoot>
    </table>
    <br>
    <hr>
    <h1>ν‘œμ—μ„œ 열끼리 λ¬ΆκΈ°</h1>
    <table>
        <caption>colgroup μ—°μŠ΅</caption>
        <colgroup>
            <col>
            <col span="2" style="background-color:skyblue;">
            <col style="background-color: yellow;">
        </colgroup>
        <tr>
            <td>1ν–‰ 1μ—΄</td>
            <td>1ν–‰ 2μ—΄</td>
            <td>1ν–‰ 3μ—΄</td>
            <td>1ν–‰ 4μ—΄</td>
        </tr>
        <tr>
            <td>2ν–‰ 1μ—΄</td>
            <td>2ν–‰ 2μ—΄</td>
            <td>2ν–‰ 3μ—΄</td>
            <td>2ν–‰ 4μ—΄</td>
        </tr>
    </table>
    <br>
</body>
</html>

ν‘œλ₯Ό λ§Œλ“€κΈ° μœ„ν•΄ html νŒŒμΌμ„ μ œμž‘ν•˜λŠ”λ°

ν‘œκ°€ 선이 없이 λ‚˜νƒ€λ‚˜λŠ” κ²°κ³Όκ°€ λ‚˜νƒ€λ‚˜μ„œ CSSλ₯Ό 살짝 λ³€κ²½ν•΄ μ£Όμ—ˆλ‹€.

(CSSλŠ” 아직 λ‚˜λ„ λͺ¨λ₯΄λ‹ˆ λ‹€μŒμ— μžμ„Ένžˆ μ•Œμ•„λ³΄μž.)

 

 


 

 

ν‘œλ₯Ό μ œμž‘ν•˜λŠ” νƒœκ·Έκ°€ μ΄λ ‡κ²Œ λ‹€μ–‘ν•  쀄 λͺ°λžλ‹€.

 

이제 μ™Έμš°λŠ” 일만 λ‚¨μ•˜λ‹€.

 

 


 

 

< μ°Έκ³  >

Do it! HTML5+CSS3 μ›Ή ν‘œμ€€μ˜ 정석

 

 

β€» ν•΄λ‹Ή 글은 μŠ΅λ“ λͺ©μ μœΌλ‘œ μž‘μ„±λœ κΈ€μž…λ‹ˆλ‹€ β€»

 

λ°˜μ‘ν˜•