๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/HTML5 + CSS3

[HTML+CSS][ํผ ๊ด€๋ จ ํƒœ๊ทธ๋“ค] 04 - ์—ฌ๋Ÿฌ ๋ฐ์ดํ„ฐ ๋‚˜์—ดํ•ด ๋ณด์—ฌ์ฃผ๊ธฐ

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2020. 6. 19.

 

 

[HTML+CSS][ํผ ๊ด€๋ จ ํƒœ๊ทธ๋“ค] 03 -

ํƒœ๊ทธ์˜ ๋‹ค์–‘ํ•œ ์†์„ฑ

ํƒœ๊ทธ" data-og-description="[HTML+CSS][ํผ ๊ด€๋ จ ํƒœ๊ทธ๋“ค] 01 - ํผ(form) [HTML+CSS] [์ด๋ฏธ์ง€์™€ ํ•˜์ดํผ๋งํฌ] 03 - SVG ์ด๋ฏธ์ง€ [HTML+CSS] [์ด๋ฏธ์ง€์™€ ํ•˜์ดํผ๋งํฌ] 02 - ๋งํฌ ํƒœ๊ทธ [HTML+CSS] [์ด๋ฏธ์ง€์™€ ํ•˜์ดํผ๋งํฌ]..

onelight-stay.tistory.com

 

ํ•œ ์ค„์งœ๋ฆฌ ๋ฐ์ดํ„ฐ์— ์–ด๋Š ์ •๋„ ๋ฐฐ์›Œ๋ณด์•˜์œผ๋‹ˆ

์ด๋ฒˆ์—๋Š” ์—ฌ๋Ÿฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๊ธฐ ์ข‹๊ฒŒ ๋‚˜์—ดํ•ด ๋ณด๋Š” ๊ฒƒ์— ๋Œ€ํ•ด์„œ ๋ฐฐ์›Œ๋ณด์ž.

 

 


 

 

<select>, <optgroup>, <option> - ๋“œ๋กญ๋‹ค์šด

 

์‚ฌ์šฉ์ž๊ฐ€ ๋‚ด์šฉ์„ ์ž…๋ ฅํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ

์—ฌ๋Ÿฌ ์˜ต์…˜ ์ค‘์—์„œ ์„ ํƒํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“  ๊ฒƒ์ด๋‹ค.

 

 

<select>

๋“œ๋กญ๋‹ค์šด ๋ชฉ๋ก์„ ์ œ์ž‘ํ•œ๋‹ค.

 

select ์†์„ฑ

 

<option>

๋“œ๋กญ๋‹ค์šด ๋ชฉ๋ก์— ํ‘œ์‹œ๋˜๋Š” ์˜ต์…˜์„ ์ง€์ •ํ•œ๋‹ค.

 

option ์†์„ฑ

 

<optgroup>

๋“œ๋กญ๋‹ค์šด ๋ชฉ๋ก์—์„œ ์—ฌ๋Ÿฌํ•ญ๋ชฉ์„ ๋ช‡ ๊ฐ€์ง€ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ์–ด์•ผ ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋ฉฐ

label ์†์„ฑ์„ ์‚ฌ์šฉํ•ด ๊ทธ๋ฃน์˜ ์ œ๋ชฉ์„ ๋ถ™์—ฌ์ค€๋‹ค.

 

 

    <form>
        <h1>์—ฌ๋ฆ„๋ฐฉํ•™ ํŠน๊ฐ• ์‹ ์ฒญ</h1>
        <fieldset>
            <legend>์ˆ˜๊ฐ• ์‹ ์ฒญ์ธ</legend>
            <ul>
                <li>
                    <label class="reg" for="u-num">ํ•™๋ฒˆ</label>
                    <input type="number" id="u-num">
                </li>
                <li>
                    <label class="reg" for="u-name">์ด๋ฆ„</label>
                    <input type="text" id="u-name">
                </li>
                <li>
                    <label class="reg" for="u-sub">ํ•™๊ณผ</label>
                    <select id="u-sub" size="5" multiple>
                        <option value="archi">๊ฑด์ถ•๊ณตํ•™๊ณผ</option>
                        <option value="mechanic">๊ธฐ๊ณ„๊ณตํ•™๊ณผ</option>
                        <option value="indust">์‚ฐ์—…๊ณตํ•™๊ณผ</option>
                        <option value="elec">์ „๊ธฐ์ „์ž๊ณตํ•™๊ณผ</option>
                        <option value="computer">์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ</option>
                        <option value="chemical">ํ™”ํ•™๊ณตํ•™๊ณผ</option>
                    </select>
                </li>
            </ul>
        </fieldset>
    </form>
    <br>
    <hr>
    <form>
        <h1>์—ฌ๋ฆ„๋ฐฉํ•™ ํŠน๊ฐ• ์‹ ์ฒญ</h1>
        <fieldset>
            <legend>์ˆ˜๊ฐ• ์‹ ์ฒญ์ธ</legend>
            <ul>
                <li>
                    <label class="reg" for="u-num">ํ•™๋ฒˆ</label>
                    <input type="number" id="u-num">
                </li>
                <li>
                    <label class="reg" for="u-name">์ด๋ฆ„</label>
                    <input type="text" id="u-name">
                </li>
                <li>
                    <label class="reg" for="u-sub">ํ•™๊ณผ</label>
                    <select id="u-sub">
                        <optgroup label="๊ณต๊ณผ๋Œ€ํ•™">
                            <option value="archi">๊ฑด์ถ•๊ณตํ•™๊ณผ</option>
                            <option value="mechanic">๊ธฐ๊ณ„๊ณตํ•™๊ณผ</option>
                            <option value="indust">์‚ฐ์—…๊ณตํ•™๊ณผ</option>
                            <option value="elec">์ „๊ธฐ์ „์ž๊ณตํ•™๊ณผ</option>
                            <option value="computer" selected>์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ</option>
                            <option value="chemical">ํ™”ํ•™๊ณตํ•™๊ณผ</option>
                        </optgroup>
                        <optgroup label="์ธ๋ฌธ๋Œ€ํ•™">
                            <option value="history">์‚ฌํ•™๊ณผ</option>
                            <option value="lang">์–ด๋ฌธํ•™๋ถ€</option>
                            <option value="philo">์ฒ ํ•™</option>
                        </optgroup>
                    </select>
                </li>
            </ul>
        </fieldset>
    </form>

 

 


 

 

<datalist>

 

ํ…์ŠคํŠธ ํ•„๋“œ์— ์ง์ ‘ ๊ฐ’์„ ์ž…๋ ฅํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ

๋ฐ์ดํ„ฐ ๋ชฉ๋ก์— ์ œ์‹œํ•œ ๊ฐ’ ์ค‘์—์„œ ์„ ํƒํ•˜๋ฉด ๊ทธ ๊ฐ’์ด ์ž๋™์œผ๋กœ ์ž…๋ ฅ๋˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

 

๋ฐ์ดํ„ฐ ๋ชฉ๋ก์€ ํ…์ŠคํŠธ ํ•„๋“œ์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— <input> ํƒœ๊ทธ๋ฅผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•ด ์ค€๋‹ค.

 

 

datalist ์†์„ฑ

 

 

    <form>
        <fieldset>
            <legend>์ˆ˜๊ฐ•ํ•  ๊ณผ๋ชฉ์„ ์„ ํƒํ•˜์„ธ์š”</legend>
            <ul>
                <li>
                    <label class="reg" for="interest">๊ด€์‹ฌ๋ถ„์•ผ</label>
                    <input type="text" id="interest" list="choices">
                    <datalist id="choices">
                        <option value="grammar" label="๋ฌธ๋ฒ•"></option>
                        <option value="voca" label="์–ดํœ˜"></option>
                        <option value="speaking" label="ํšŒํ™”"></option>
                        <option value="listening" label="๋ฆฌ์Šค๋‹"></option>
                        <option value="news" label="๋‰ด์Šค์ฒญ์ทจ"></option>
                    </datalist>
                </li>
            </ul>
        </fieldset>
    </form>

 

 


 

 

<textarea> - ์—ฌ๋Ÿฌ์ค„ ์ž‘์„ฑ ๊ฐ€๋Šฅํ•œ ํ…์ŠคํŠธ ์˜์—ญ

 

ํ•œ ์ค„ ์ด์ƒ์˜ ๋ฌธ์žฅ์ž…๋ ฅ์„ ํ•„์š”๋กœ ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํผ์ด๋‹ค.

 

 

textarea ์†์„ฑ

 

 

    <form>
        <fieldset>
            <legend>์ข‹์€ ๊ธ€๊ท€</legend>
            <textarea name="intro"cols="60" rows="5">
    ๊ทผ๋ฉด์œผ๋กœ ๋ถ€์ž๊ฐ€ ๋˜์—ˆ๋‹ค๊ณ  ๋งํ•˜๋Š” ์ด๊ฐ€ ์žˆ๋‹ค๋ฉด ๋ฌผ์–ด๋ณด์•„๋ผ.
    ๋ˆ„๊ตฌ์˜ ๊ทผ๋ฉด์ด์—ˆ๋Š”์ง€.

    when a man tells you that he got rich
    through hard work, ask him: 'whose?'
            </textarea>
        </fieldset>
    </form>

 

 

 


 

 

์•ž์ „์— ๋‹ค๋ฅธ ํŒŒํŠธ๋ฅผ ๊ณต๋ถ€ํ• ๋•Œ ๋“œ๋กญ๋‹ค์šด์— ๋Œ€ํ•ด ์•Œ์ง€ ๋ชปํ•ด์„œ

ํ…์ŠคํŠธ ํƒ€์ž…์œผ๋กœ ๊ปด๋งž์ถฐ์„œ ๋‹ต๋‹ตํ•˜๊ณ  ๋ฏผ๋งํ–ˆ๋Š”๋ฐ

์ด๋ฒˆ์— ์•Œ๊ฒŒ ๋˜์–ด์„œ ์†์ด ํ›„๋ จํ•˜๋‹ค.

 

 


 

 

< ์ฐธ๊ณ  >

Do it! HTML5+CSS3 ์›น ํ‘œ์ค€์˜ ์ •์„

 

 

โ€ป ํ•ด๋‹น ๊ธ€์€ ์Šต๋“ ๋ชฉ์ ์œผ๋กœ ์ž‘์„ฑ๋œ ๊ธ€์ž…๋‹ˆ๋‹ค โ€ป

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€