Form HTML
Form HTML
Form merupakan bagian pada HTML yang dapat digunakan untuk membuat elemen Form atau formulir pada halaman Web.
Jenis-Jenis atau Type Input pada Form
- <input type="text"> : yang berfungsi untuk input teks bari tunggal
- <input type="submit"> : yang berfungsi sebagai tombol
- <input type="email"> : yang berfungsi sebagai tempat input email
- <input type="color"> : yang berfungsi sebagai tempat input color atau warna
- <input type="datetime"> : yang berfungsi sebagai tempat input tanggal dan waktu/jam
- <input type="time"> : yang berfungsi sebagai tempat input waktu atau jam
- <input type="file"> : yang berfungsi sebagai tempat input / upload file
- <input type="email"> : yang berfungsi sebagai tempat input email
- <input type="hidden"> : yang berfungsi sebagai tempat input yang tidak terlihat oleh user
- <input type="number"> : yang berfungsi sebagai tempat input angka
- <input type="password"> : yang berfungsi sebagai tempat input password
- <input type="range"> : yang berfungsi sebagai tempat input rentang nilai
Dan masih banyak lagi
Contoh Penggunaan
1. Type Color
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Color</h1>
<form>
<label>Color</label>
<input type="color">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
2. Type Datetime
code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Date Time</h1>
<form>
<label>Date Time</label>
<input type="datetime-local">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
3. Type Time
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Time</h1>
<form>
<label>Time</label>
<input type="time">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
4. Type File
code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type File</h1>
<form>
<label>Foto</label>
<input type="file">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
5. Type Hidden
code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Hidden</h1>
<form>
<label>Hidden</label>
<input type="hidden">
<br>
<br>
<label>Name</label>
<input type="text">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
6. Type Number
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Number</h1>
<form>
<label>Number</label>
<input type="number">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasilnya
7. Type Password
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Password</h1>
<form>
<label>Password</label>
<input type="password">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasilnya :
8. Type Range
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form HTML || Muhammad Fahmi 'Ainunnajib</title>
</head>
<body>
<h1>Input Type Range</h1>
<form>
<label>Range</label>
<input type="range">
<br>
<br>
<input type="submit" value="simpan">
</form>
</body>
</html>
Hasil :
Sekian untuk pembasan dari form html.
Link GitHub : https://github.com/Fahm11/WEB/tree/main/HTML/PART9
Komentar
Posting Komentar