HTML, CSS

폼태그 기초 시작(input type=button/reset/submit/image/text/password/checkbox/radio/file/hidden...

JooKit 주킷 2021. 6. 2. 13:10
목차 접기
728x90
반응형
<!DOCTYPE html>
<html lang="ko">
<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>폼태그</title>
</head>
<body>
    <form action="#" method="POST">
        <!-- name은 페이지 이동할때 이동한 페이지에서 참조하는 값 -->
        아이디 : <input type="text" name="text"  /> <br>
        비밀번호 : <input type="password" name="password" /> <br>

        <!-- radio버튼은 오로지 1개만 선택할 수 있도록 name 속성을 동일하게 반드시 가져가야 한다. -->
        성별 남 <input type="radio" name="gender" value="man">
        여 <input type="radio" name="gender" value="woman"><br>

        <!-- checkbox는 다중 선택이 가능한 입력양식이며 반드시 name이 동일해야 한다. -->
        취미 독서 <input type="checkbox" name="hobby" value="reading" />
        운동 <input type="checkbox" name="hobby" value="health" />
        코딩 <input type="checkbox" name="hobby" value="coding" /> <br>
        파일 첨부 <input type="file" name="file" />

        <input type="hidden" name="hidden" value="12:10" /> <br>

        <input type="button" value="버튼"/><br>
        <input type="reset" value="초기화"/><br>
        <input type="submit" value="전송"><br>
        <input type="image" src="img.jpg">
    </form>
</body>
</html>
728x90
반응형
LIST