๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
CODING/WEB

[HTML] ๋ฐ์ดํ„ฐ ๋ชฉ๋ก & ๋‹ค์–‘ํ•œ form ์š”์†Œ๋“ค

by ๋ฐํ†จ๋งนํ†จ 2020. 10. 17.
728x90
728x90

๐Ÿ“Œ<optgroup></optgroup> ํƒœ๊ทธ

 

- ์—ฌ๋Ÿฌ ํ•ญ๋ชฉ์„ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ์„ ๋•Œ ์‚ฌ์šฉ

- label ์†์„ฑ์„ ์‚ฌ์šฉํ•ด ๊ทธ๋ฃน ์ œ๋ชฉ์„ ๋ถ™์ž„

- [<select> โžก๏ธ <optgroup> โžก๏ธ <option>] ์ˆœ์œผ๋กœ ๋ชฉ๋ก ๋งŒ๋“ค๋ฉด ๋จ

๋”๋ณด๊ธฐ
        <select id="class">
            <optgroup label = "๊ณต๊ณผ๋Œ€ํ•™">
                <option value="archi">๊ฑด์ถ•๊ณตํ•™๊ณผ</option>
                <option value="mechanic">๊ธฐ๊ณ„๊ณตํ•™๊ณผ</option>
                <option value="indust">์‚ฐ์—…๊ณตํ•™๊ณผ</option>
                <option value="elec">์ „๊ธฐ์ „์ž๊ณตํ•™๊ณผ</option>
                <option value="computer">์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ</option>
                <option value="chemical">ํ™”ํ•™๊ณตํ•™๊ณผ</option>
            </optgroup>
            <optgroup label="์ธ๋ฌธ๋Œ€ํ•™">
                <option value="history">์‚ฌํ•™๊ณผ</option>
                <option value="lang">์–ด๋ฌธํ•™๊ณผ</option>
                <option value="philo">์ฒ ํ•™๊ณผ</option>
            </optgroup>
        </select>

 

 

๐Ÿ“Œ<datalist></datalist> ํƒœ๊ทธ

 

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

- ๋ฐ์ดํ„ฐ ๋ชฉ๋ก id๋ฅผ ์ด์šฉํ•ด ์ด๋ฆ„์„ ๋ถ™์ด๊ณ , <input> ํƒœ๊ทธ list ์†์„ฑ์— id ๊ฐ’์„ ๋„ฃ์–ด์คŒ

๋”๋ณด๊ธฐ
        <input type="text" id="interest" list="choices">
        <datalist id="choices">
            <option value="grammer" label="๋ฌธ๋ฒ•"></option>
            <option value="voca" label="์–ดํœ˜"></option>
            <option value="speaking" label="ํšŒํ™”"></option>
            <option value="listening" label="๋ฆฌ์Šค๋‹"></option>
            <option value="news" label="๋‰ด์Šค์ฒญ์ทจ"></option>
        </datalist>

์ž…๋ ฅ์ „ 
์ž…๋ ฅํ›„

 

๐Ÿ“Œ<textarea></textarea> ํƒœ๊ทธ

 

- ํ…์ŠคํŠธ ์˜์—ญ - ์—ฌ๋Ÿฌ์ค„์˜ ํ…์ŠคํŠธ ์ž…๋ ฅ

ex) ๊ฒŒ์‹œํŒ์˜ ๊ฒŒ์‹œ๋ฌผ ์ž…๋ ฅ์ฐฝ

๋”๋ณด๊ธฐ
<textarea cols="50" rows="5">์•ˆ๋…•ํ•˜์„ธ์š” ๋ญ๋ผ๊ณ  ์จ์•ผํ• ์ง€ ๋ชจ๋ฅด๊ฒ ์–ด์š”</textarea>

 

๐Ÿ“Œ<button></button> ํƒœ๊ทธ

 

๋‹ค์–‘ํ•œ ํ˜•ํƒœ์˜ ๋ฒ„ํŠผ ์‚ฝ์ž…

- ํ™”๋ฉด ๋‚ญ๋…๊ธฐ์—์„œ ๋ฒ„ํŠผ์ž„์„ ์ •ํ™•ํžˆ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์Œ

- css๋ฅผ ์ด์šฉํ•ด ์›ํ•˜๋Š” ํ˜•ํƒœ๋กœ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ์Œ

๋”๋ณด๊ธฐ
        <form>
            <button type="submit" class="subm">
                <img src="images/๋ฏธ์†Œ์˜ ์„ธ์ƒ.jpg" alt=""> ์ „์†กํ•˜๊ธฐ
            </button>
        </form>

<body> ์•ˆ

        <style>
            .subm {
                display: block;
                background-color: azure;
                border: 1px solid #dedede;
                cursor: pointer;
                padding: 5px 10px 6px 7px;}
            .subm img{
                border:0; /* ํ…Œ๋‘๋ฆฌ ์—†์Œ*/ 
                padding:0; /* ํŒจ๋”ฉ ์—†์Œ */ 
                width:16px; /* ๊ฐ€๋กœ ํฌ๊ธฐ */ 
                height:16px; /* ์„ธ๋กœ ํฌ๊ธฐ */
            }
            .subm:hover{
                background-color: chocolate ;
                border: 1px solid #dffd22;
                color: cornsilk;
            }
        </style>

<head> ์•ˆ์—์„œ ์Šคํƒ€์ผ ์ง€์ •

ํ‰์†Œ ์ƒํƒœ
๋งˆ์šฐ์Šค๋ฅผ ์˜ฌ๋ ค๋†จ์„ ๋•Œ css๋กœ ์„ค์ •๊ฐ€๋Šฅ


[ ๋‹ค์–‘ํ•œ ํผ ์š”์†Œ๋“ค ] 

๐Ÿ“Œ<output></output>ํƒœ๊ทธ

๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ํ‘œ์‹œ

๋”๋ณด๊ธฐ
        <form oninput="result.value = parseInt(num1.value) * parseInt(num2.value)">
            <input type="number" name="num1" value="0"> 
            *<input type="number" name="num2" value="0"> 
            =<output name="result" for="num"></output>
        </form>

 

๐Ÿ“Œ<progress></progress>ํƒœ๊ทธ

- ์ž‘์—… ์ง„ํ–‰ ์ƒํƒœ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์— ํ‘œ์‹œ

- ๊ฐ’์— ํŠน๋ณ„ํ•œ ๋‹จ์œ„๋Š” ์—†๊ณ  ํ‘œ์‹œํ•˜์ง€ ์•Š์Œ

 

[ ์†์„ฑ ]

๐Ÿ”Ž value -  ํ˜„์žฌ ๊ฐ’ โžก๏ธ 0~max๊ฐ’์˜ ์‚ฌ์ด์— ๊ฐ’์ด ์žˆ์–ด์•ผํ•จ 

๐Ÿ”Ž max - ์ตœ๋Œ€ ๊ฐ’

 

๋”๋ณด๊ธฐ
        <label>10์ดˆ ๋‚จ์Œ</label>
        <progress value="50" max="60"> </progress>
        <label>์ง„ํ–‰๋ฅ  30%</label>
        <progress value="30" max="100"></progress>

 

 

๐Ÿ“Œ<meter></meter>ํƒœ๊ทธ

- ์ „์ฒด ํฌ๊ธฐ ์ค‘์—์„œ ์–ผ๋งˆ๋‚˜ ์ฐจ์ง€ํ•˜๋Š”์ง€ ํ‘œํ˜„ํ•  ๋•Œ ์‚ฌ์šฉ

ex ) ํ•˜๋“œ ๋””์Šคํฌ ์‚ฌ์šฉ๋Ÿ‰, ์œ ๊ถŒ์ž ํˆฌํ‘œ์œจ ๋“ฑ 

 

[ ์†์„ฑ ]

๐Ÿ”Ž min, max  - ์ตœ์†Ÿ๊ฐ’, ์ตœ๋Œ“๊ฐ’

๐Ÿ”Ž value - ํ˜„์žฌ ๊ฐ’

๐Ÿ”Ž low, high - ์ด ๊ฐ’๋“ค์„ ๋„˜์–ด๊ฐ€๋ฉด ์ ๊ฑฐ๋‚˜ ๋งŽ๋‹ค๋Š” ๊ฑธ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ’

๐Ÿ”Ž optimum - ์ด์ •๋„๋ฉด ์ ๋‹นํ•˜๋‹ค๊ณ  ํ•  ์ •๋„์˜ ๋ฒ”์œ„ ์ด ๊ฐ’์ด high๋ณด๋‹ค ํฌ๋ฉด value๊ฐ’์ด ํด์ˆ˜๋ก ์ข‹๊ณ  low๋ณด๋‹ค ์ž‘์œผ๋ฉด value๊ฐ’์ด ์ž‘์„์ˆ˜๋ก ์ข‹๋‹ค.

๋”๋ณด๊ธฐ
        <label>์ ์œ ์œจ 0.8 </label> 
        <meter value="0.8"></meter>
        <label>์‚ฌ์šฉ๋Ÿ‰ 64%</label>
        <meter min="0" max="100" value="64"></meter>
        <label>ํŠธ๋ž˜ํ”ฝ ์ดˆ๊ณผ</label>
        <meter min="1024" max="10240" low="2048" high="8192" value="9213"></meter>
        <label>์ ์ ˆํ•œ ํŠธ๋ž˜ํ”ฝ</label>
        <meter value="0.5" optimum="0.8" high="0.7"></meter>

 

 

 

 

728x90

๋Œ“๊ธ€