๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Web/๐Ÿงฉ html + CSS

ํ…Œ์ด๋ธ” ์†์„ฑ

ํ…Œ์ด๋ธ”์— ๋‹ค์Œ ์†์„ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ CSS ์Šคํƒ€์ผ์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

1. border

2. border-collapse

3. border-top, border-bottom, border-right, border-left

4. td์˜ width, height

5. text-align

6. vertical-align

 

1. border ์†์„ฑ

border ์†์„ฑ์œผ๋กœ ํ…Œ์ด๋ธ”์˜ ํ…Œ๋‘๋ฆฌ(border)๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 2px solid orange;
      }

    </style>
  </head>

  <body>
    <table>
      <tr>
        <td>์‚ฌ๊ณผ</td>
        <td>๋ฐ”๋‚˜๋‚˜</td>
        <td>๋”ธ๊ธฐ</td>
      </tr>
      <tr>
        <td>์ˆ˜๋ฐ•</td>
        <td>์ž๋‘</td>
        <td>์ฒด๋ฆฌ</td>
      </tr>
      <tr>
        <td>ํ‚ค์œ„</td>
        <td>์˜ค๋ Œ์ง€</td>
        <td>์ฐธ์™ธ</td>
      </tr>
    </table>
  </body>
</html>

 

2. border-collapse ์†์„ฑ

border-collapse ์†์„ฑ๊ฐ’์„ collapse๋กœ ์„ค์ •ํ•˜๋ฉด ํ•ด๋‹น ํ…Œ์ด๋ธ”์˜ ํ…Œ๋‘๋ฆฌ๋Š” ํ•œ ์ค„๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.

 

<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 2px solid orange;
      }
      table {
        border-collapse: collapse;
      }
    </style>
  </head>

  <body>
    <table>
...์ƒ๋žต
    </table>
  </body>
</html>

 

3. border-top, border-bottom, border-right, border-left ์†์„ฑ

 

๋‹ค์Œ ์†์„ฑ์€  top, bottom, right, left ๋ฐฉํ–ฅ์œผ๋กœ ํ…Œ๋‘๋ฆฌ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. 

 

<html>
  <head>
    <style>
      td {
        border-bottom: 1px solid blue;
      }
    </style>
  </head>

  <body>
    <table>
...์ƒ๋žต
    </table>
  </body>
</html>

 

4. td์˜ width, height

td์˜ width, height ์†์„ฑ์„ ์ด์šฉํ•ด ์…ธ์˜ ํฌ๊ธฐ๋ฅผ ์กฐ์ ˆํ•  ์ˆ˜ ์žˆ๋‹ค. 

 

<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 2px solid orange;
      }
      table {
        border-collapse: collapse;
      }
      td {
        width: 200px;
        height: 100px;
      }
    </style>
  </head>

  <body>
    <table>
...์ƒ๋žต
    </table>
  </body>
</html>

 

 

5. text-align ์†์„ฑ

ํ…Œ์ด๋ธ” ์š”์†Œ ๋‚ด๋ถ€์˜ ํ…์ŠคํŠธ๋ฅผ ์ˆ˜ํ‰ ๋ฐฉํ–ฅ ์ •๋ ฌ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

 

<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 2px solid orange;
      }
      table {
        border-collapse: collapse;
      }
      td {
        width: 200px;
        height: 100px;
      }
    </style>
  </head>

  <body>
    <table>
      <tr>
        <td>์‚ฌ๊ณผ</td>
        <td>๋ฐ”๋‚˜๋‚˜</td>
        <td>๋”ธ๊ธฐ</td>
      </tr>
      <tr>
        <td style="text-align: center">์ˆ˜๋ฐ•</td>
        <td style="text-align: center">์ž๋‘</td>
        <td style="text-align: center">์ฒด๋ฆฌ</td>
      </tr>
      <tr>
        <td style="text-align: right">ํ‚ค์œ„</td>
        <td style="text-align: right">์˜ค๋ Œ์ง€</td>
        <td style="text-align: right">์ฐธ์™ธ</td>
      </tr>
    </table>
  </body>
</html>

 

6. vertical-align ์†์„ฑ

ํ…Œ์ด๋ธ” ์š”์†Œ ๋‚ด๋ถ€์˜ ํ…์ŠคํŠธ๋ฅผ ์ˆ˜์ง ๋ฐฉํ–ฅ ์ •๋ ฌ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

 

<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 2px solid orange;
      }
      table {
        border-collapse: collapse;
      }
      td {
        width: 200px;
        height: 100px;
      }
    </style>
  </head>

  <body>
    <table>
      <tr>
        <td style="vertical-align: top">์‚ฌ๊ณผ</td>
        <td style="vertical-align: top">๋ฐ”๋‚˜๋‚˜</td>
        <td style="vertical-align: top">๋”ธ๊ธฐ</td>
      </tr>
      <tr>
        <td>์ˆ˜๋ฐ•</td>
        <td>์ž๋‘</td>
        <td>์ฒด๋ฆฌ</td>
      </tr>
      <tr id="last">
        <td style="vertical-align: bottom">ํ‚ค์œ„</td>
        <td style="vertical-align: bottom">์˜ค๋ Œ์ง€</td>
        <td style="vertical-align: bottom">์ฐธ์™ธ</td>
      </tr>
    </table>
  </body>
</html>

 

'Web > ๐Ÿงฉ html + CSS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

์ •๋ ฌ Tip  (0) 2020.11.03
๋ฐ•์Šค ๋ชจ๋ธ  (0) 2020.11.03
ํฌ๊ธฐ  (0) 2020.11.03
background ์†์„ฑ  (0) 2020.11.03
font ์†์„ฑ  (0) 2020.11.03