1. HTML

html label 과 input 태그를 동시에 쓰기

도피디 2024. 11. 8. 00:06
반응형
<!DOCTYPE html>
<html lang="kr">
<head>
<title>Home - My first website.</title>
</head>
<body>
<form>
<label for="profile">Profile Photo</label>
<input id="profile" type="file" accept=".jpg" />

<label for="first-name">First Name</label>
<input id="first-name" required placeholder="Name" type="text" />
<input required placeholder="Last Name" type="text" />
<input required placeholder="Username" type="text" />
<input required placeholder="Password" minlength="10" type="password" />
<input type="submit" value="Create Account" />
</form>
</body>
</html>

 

 

 

결과

- Profile Photo 문자 클릭 시: 파일창이 열림

- First Name 문자 클릭 시: Name input 창에 커서가 생김

 


 

반응형