μ›Ή μƒμ—μ„œ 섀문지 νŽ˜μ΄μ§€μ— μ΄μš©ν•˜κΈ° 쒋은 fieldset νƒœκ·Έμ— λŒ€ν•΄μ„œ μ•Œμ•„λ³΄κ² μŠ΅λ‹ˆλ‹€.

fieldset νƒœκ·ΈλŠ” formλ‚΄μ—μ„œ μ—°κ΄€λœ μ—˜λ¦¬λ¨ΌνŠΈλ“€μ„ κ·Έλ£Ήν™”ν•  λ•Œ μ‚¬μš©ν•©λ‹ˆλ‹€.

그리고 κ·Έλ ‡κ²Œ κ·Έλ£Ήν™”λœ μ—˜λ¦¬λ¨ΌνŠΈλ“€μ„ λ‘˜λŸ¬μ‹Ό 선을 κ·Έλ €μ€λ‹ˆλ‹€.

μ•„λž˜μ²˜λŸΌ 말이죠

<fieldset> νƒœκ·Έλ₯Ό ν™œμš©ν•œ 섀문지 예제

μœ„ 처럼 화면에 좜λ ₯ν•˜λ €λ©΄ μ•„λž˜ μ½”λ“œλ₯Ό μ΄μš©ν•˜λ©΄ λ©λ‹ˆλ‹€.

<form action="#">
  <fieldset>
      <legend>1. μ’‹μ•„ν•˜λŠ” 색깔은?</legend>
      <input type="radio" id="blue" name="favorite-color"><label for="blue">νŒŒλž€μƒ‰</label>
      <input type="radio" id="green" name="favorite-color"><label for="green">μ΄ˆλ‘μƒ‰</label>
      <input type="radio" id="red" name="favorite-color"><label for="red">빨간색</label>
    </fieldset>
    
    <p></p>
    
    <fieldset>
      <legend>2. μ’‹μ•„ν•˜λŠ” μŒμ‹ μ’…λ₯˜λŠ”?</legend>
      <input type="radio" id="korean" name="food-type"><label for="korean">ν•œμ‹</label>
      <input type="radio" id="american" name="food-type"><label for="american">양식</label>
      <input type="radio" id="japanese" name="food-type"><label for="japanese">일식</label>
      <input type="radio" id="chinese" name="food-type"><label for="chinese">쀑식</label>
    </fieldset>
</form>

 

즉, legend νƒœκ·Έλ₯Ό μ΄μš©ν•˜μ—¬ 타이틀을 λ„£μ–΄μ£Όκ³  input μ΄λ‚˜ textarea와 같은 νƒœκ·Έλ“€μ„ μ΄μš©ν•΄μ„œ μ‚¬μš©μžμ˜ μž…λ ₯을 받을 수 μžˆλ„λ‘ ν•©λ‹ˆλ‹€.

μœ„ μ½”λ“œμ— ν•˜λ‚˜μ˜ ν•„λ“œμ…‹μ„ 더 μΆ”κ°€ν•˜μ—¬ 주관식 문항을 λ„£μ–΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€.

 

<fieldset> νƒœκ·Έλ₯Ό ν™œμš©ν•œ 섀문지 예제

<form action="#">
    <fieldset>
      <legend>1. μ’‹μ•„ν•˜λŠ” 색깔은?</legend>
      <input type="radio" id="blue" name="favorite-color"><label for="blue">νŒŒλž€μƒ‰</label>
      <input type="radio" id="green" name="favorite-color"><label for="green">μ΄ˆλ‘μƒ‰</label>
      <input type="radio" id="red" name="favorite-color"><label for="red">빨간색</label>
    </fieldset>
    <p></p>
    <fieldset>
      <legend>2. μ’‹μ•„ν•˜λŠ” μŒμ‹ μ’…λ₯˜λŠ”?</legend>
      <input type="radio" id="korean" name="food-type"><label for="korean">ν•œμ‹</label>
      <input type="radio" id="american" name="food-type"><label for="american">양식</label>
      <input type="radio" id="japanese" name="food-type"><label for="japanese">일식</label>
      <input type="radio" id="chinese" name="food-type"><label for="chinese">쀑식</label>
    </fieldset>
    <p></p>
    <fieldset>
      <legend>3. νƒ•μˆ˜μœ‘μ€ μ–΄λ–»κ²Œ λ¨Ήμ–΄μ•Ό λ§›μžˆλ‚˜μš”?</legend>
      <textarea placeholder="생각을 μ μ–΄μ£Όμ„Έμš”."></textarea>
    </fieldset>
  </form>

 

fieldset νƒœκ·ΈλŠ” 크둬, 파폭, 엣지, 였페라 λ“± λŒ€λΆ€λΆ„μ˜ λΈŒλΌμš°μ €μ—μ„œ μ§€μ›ν•˜κ³  있으며 fieldset의 μ†μ„±μœΌλ‘œ disabledλ₯Ό λͺ…μ‹œν•΄μ£Όλ©΄ ν•΄λ‹Ή ν•„λ“œμ…‹ λ‚΄μ˜ μ—˜λ¦¬λ¨ΌνŠΈλ“€μ΄ λͺ¨λ‘ λΉ„ν™œμ„±ν™” μ²˜λ¦¬λ©λ‹ˆλ‹€.

 

κ°œμΈλΈ”λ‘œκ·Έ λ§Œλ“€κΈ° ν”„λ‘œμ νŠΈν•˜λ‹€κ°€ μ•Œκ²Œλœ μƒˆλ‘œμš΄ νƒœκ·ΈλΌ 기둝용으둜 ν¬μŠ€νŒ…ν•΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€.

 

 

μ°Έκ³ λ¬Έμ„œ: https://developer.mozilla.org/ko/docs/Web/HTML/Element/fieldset