HTML & CSS πŸ’™/HTML μ—°μŠ΅

2일차 table νƒœκ·Έ

Maryland_09 2020. 10. 24. 16:22

 

 

 

 

 

 

 

 

ν‘œ ν˜•μ‹μ˜ λ ˆμ΄μ•„μ›ƒμ„ λ§Œλ“œλŠ” νƒœκ·Έ

<table> </table> 사이에 <tr> <td>νƒœκ·Έλ₯Ό λ„£λŠ”λ‹€.

 

  • <table> : ν‘œλ₯Ό λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ
  • <tr> : 행을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ (table row)
  • <th> : 제λͺ© 셀을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ (table header)
  • <td> : 셀을 λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ (table data)
  • <caption>: ν‘œμ˜ 제λͺ©μ„ λ‚˜νƒ€λ‚΄λŠ” νƒœκ·Έ
  • <thead>: 제λͺ© 행을 κ·Έλ£Ήν™”ν•˜λŠ” νƒœκ·Έ
  • <tfoot>: λ°”λ‹₯ 행을 κ·Έλ£Ήν™”ν•˜λŠ” νƒœκ·Έ
  • <tbody>: λ³Έλ¬Έ 행을 κ·Έλ£Ήν™”ν•˜λŠ” νƒœκ·Έ

 

 

<tr>

      <td>Korean</td>

      <td>Math</td>

      <td>Science</td>

</tr>

 

<tr> νƒœκ·Έ μ•ˆμ— <td>κ°€ λŠ˜μ–΄λ‚  수둝 κ°€λ‘œ 셀이 μ—¬λŸ¬κ°œκ°€ 생긴닀.

μ„Έλ‘œλ‘œ 행을 늘리고 μ‹ΆμœΌλ©΄ <tr>νƒœκ·Έλ₯Ό 늘렀주면 λœλ‹€. 

 

 

Border: ν…Œμ΄λΈ”μ˜ λ‘κ»˜ μ„€μ •

큰 λ”°μ˜΄ν‘œ μ•ˆμ— 숫자λ₯Ό λ„£μ–΄ λ‘κ»˜ 값을 λ„£μ–΄μ€€λ‹€. 

<table border="2"> border - ν…Œμ΄λΈ”μ˜ ν…Œλ‘λ¦¬ λ‘κ»˜

 

 

Colspan : μ—΄ ν•©μΉ˜κΈ° (κ°€λ‘œλ‘œ)

λ”°μ˜΄ν‘œ μ•ˆμ— 숫자λ₯Ό λ„£μ–΄ λͺ‡ 개의 열을 ν•©ν•  것인지 값을 λ„£μ–΄μ€€λ‹€.

<td colspan="2">

 

Rowspan: ν–‰ ν•©μΉ˜κΈ° (μ„Έλ‘œλ‘œ)

colspanκ³Ό λ§ˆμ°¬κ°€μ§€λ‘œ λͺ‡ 개λ₯Ό ν•©ν•  것인지 값을 λ„£μ–΄μ€€λ‹€. 

<td rowspan="4">

 

<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>repl.it</title>
	<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<table border="3">
		<tr>
			<td rowspan="4"> Mid-term test scores </td>
		</tr>

		<tr>
			<td>Korean</td>
			<td>Math</td>
			<td>Science</td>
		</tr>
		<tr>
			<td>100</td>
			<td>95</td>
			<td>98</td>
		</tr>
		<tr>
			<td colspan="2"> Average </td>
			<td>90</td>
		</tr>
	</table>

<table>
  <table border="1">
    <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>

     <tr>
      <td colspan="2">3ν–‰ 1μ—΄</td>
      <td>3ν–‰ 3μ—΄</td>
      <td>3ν–‰ 4μ—΄</td>
    </tr>
  </table>
  
</body>

</html>

 

 

κ²°κ³Όλ¬Ό