๐ŸŒฑ → ๐ŸŒณ

[HTML] Select Tag, Input Tag ๋ณธ๋ฌธ

Client/HTML CSS

[HTML] Select Tag, Input Tag

BAY 2022. 6. 21. 17:46
728x90

๐Ÿ“Œ <select> Tag

์„ ํƒ ๋ฉ”๋‰ด(๋“œ๋กญ ๋‹ค์šด)์„ ๋งŒ๋“œ๋Š” ํƒœ๊ทธ

<select>: select ํผ ์ƒ์„ฑ

  • name: select 

<option>: select ํผ์˜ ์˜ต์…˜ ๊ฐ’ ์ƒ์„ฑ

  • value: ์‹ค์ œ์ ์œผ๋กœ ์ „๋‹ฌ๋˜๋Š” ๊ฐ’(์ปดํ“จํ„ฐ๊ฐ€ ์ฝ๋Š” ๊ฐ’)
  • selected: ์ตœ์ดˆ์— ์„ ํƒ๋œ ๊ฐ’์œผ๋กœ ์„ค์ • 
  • disabled: ์˜ต์…˜์€ ๋ณด์ด์ง€๋งŒ ์„ ํƒ์„ ๋ชปํ•˜๋„๋ก ์„ค์ •

<optgroup>: option์„ ๊ทธ๋ฃนํ™”

  • label: optgroup ์ด๋ฆ„ ์„ค์ •

์˜ˆ์‹œ ์ฝ”๋“œ 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Select</title>
</head>
<body>
    <select name="" id="">
        <!-- selected๋Š” select tag 1๊ฐœ๋‹น 1๊ฐœ -->
        <optgroup label="color">
            <option value="black" selected>black</option>
            <option value="sliver">sliver</option>
            <option value="skyblue">skyblue</option>
            <option value="pink">pink</option>
        </optgroup>
        <optgroup label="size">
            <option value=S">S</option>
            <option value="M">M</option>
            <option value="L" disabled>L(Sold out)</option>
        </optgroup>
    </select>
</body>
</html>

 

selected๋กœ ์ตœ์ดˆ ๊ฐ’ ์„ค์ •๋œ select form

 

select ํŽผ์ณค์„ ๋•Œ

๐Ÿ“Œ <input> Tag

๋ฒก์—”๋“œ๋ฅผ ์œ„ํ•ด,, ์•ž์œผ๋กœ ํ˜‘์—…์„ ์œ„ํ•ด ,, ๋ชจ๋“  input์—๋Š” name์„ ์ง€์ •ํ•ด ์ฃผ๋Š” ๊ฒƒ์ด ์ข‹์Œ

type=""

  • button
  • text (placeholder: ์‚ฌ์šฉ์ž์—๊ฒŒ ์–ด๋–ค ํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋Š”์ง€ ์•Œ๋ ค์ฃผ๋Š” ์†์„ฑ)
  • password
  • checkbox
  • radio
  • date (datetime-local)
  • color

 

728x90

'Client > HTML CSS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[CSS] CSS SELECTOR  (0) 2022.06.21
[CSS] CSS ์ƒ์†  (0) 2022.06.21
[HTML] Span Tag  (0) 2022.06.21
[HTML] HTML ๊ตฌ์กฐ  (0) 2022.06.19
[CSS] Flexbox  (0) 2022.05.10