-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTML-form.html
198 lines (179 loc) · 5.43 KB
/
HTML-form.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Form</title>
<style>
body {
font: 100% arial, helvetica, sans-serif;
}
fieldset {
padding: 0 1em 1em 1em;
border:2px solid blueviolet;
}
legend {
padding: 1em;
}
/* label{
float: left;
clear: left;
width: 90px;
} */
textarea:focus{
background-color: chartreuse;
}
select:focus{
background-color: tomato;
color: whitesmoke;
}
/* ============== */
form.exam{
display: table;
}
div.exam{
display: table-row;
}
div label,input{
display: table-cell;
margin-bottom: 0.625rem;
}
label {
padding-right: 0.625rem;
}
/* ========= */
.day{
padding-left: 5rem;
}
.day select,button{
margin-left: 5rem;
}
:required{
background-color: rgba(0, 128, 128, 0.39);
}
</style>
</head>
<body>
<h1 id="top">Basic Form</h1>
<form action="contactus.php" method="post">
<p>Name:</p>
<p><input type="text" name="name" value="Your name"></p>
<p>Address:</p>
<p><input name="location"></p>
<!-- remember: 'type="text"' isn't actually necessary -->
<p>Comments: </p>
<p><textarea name="comments" rows="5" cols="20">Your comments</textarea></p>
<p>Are you:</p>
<p><input type="radio" name="areyou" value="male"> Male</p>
<p><input type="radio" name="areyou" value="female"> Female</p>
<p><input type="radio" name="areyou" value="other">Other</p>
<p>how would you rate our service?</p>
<p><input type="checkbox" name="" id="">Good</p>
<p><input type="checkbox" name="" id="">Average</p>
<p><input type="checkbox" name="" id="">Bad</p>
<p><input type="checkbox" name="" id="">Worse</p>
<p><input type="submit"></p>
</form>
<hr>
<h1>Label</h1>
<form action="">
<label for="username">Username:</label>
<input name="username" id="username" value="Some Text"><br>
<label for="password">Password:</label>
<input type="password" name="password" id="password" value="Password">
</form>
<hr>
<h1>Field sets and legends</h1>
<form action="">
<fieldset>
<fieldset>
<legend>Name</legend>
<label for="firstName">First Name</label>
<input type="text" name="firstName" id="yourName"><br>
<label for="lastName">Last Name</label>
<input type="text" name="lastName" id="yourName">
</fieldset>
<br>
<fieldset>
<legend>Upload NID</legend>
<label for="uploadfile">File name: </label>
<input type="file" name="uploadfile" id="uploadfile">
</fieldset>
<br>
<fieldset>
<legend>Address</legend>
<label for="address">Area:<textarea name="address"></textarea></label>
<label for="pcode">Postal code: <input type="text" name="postcode"></label>
</fieldset>
<br>
<fieldset>
<legend>City</legend>
<select name="country" id="">
<optgroup label="Bangladesh">
<option value="dak">Dhaka</option>
<option value="syl">Sylhet</option>
<option value="chitt">Chittagong</option>
</optgroup>
<optgroup label="England">
<option value="ldn">London</option>
<option value="Lvrpl">Liverpool</option>
<option value="newct">Newcastle</option>
</optgroup>
<optgroup label="Africa">
<option value="gam">Gambia</option>
<option value="mad">Madagascar</option>
<option value="nam">Namibia</option>
</optgroup>
</select>
</fieldset>
<br>
<input type="submit" value="Submit!">
</fieldset>
</form>
<hr>
<form action="" class="exam">
<div class="exam">
<label for="name">Your name:</label>
<input type="text" id="name" name="name" required autofocus>
</div>
<div class="exam">
<label for="ID">Your ID:</label>
<input type="text" id="ID" name="ID" required>
</div>
<div class="exam">
<label for="semester">Current Semester:</label>
<p><input type="checkbox" value="Spring">Spring</p>
<p><input type="checkbox" value="Summer">Summer</p>
<p><input type="checkbox" value="Fall">Fall</p>
</div>
<div class="exam">
<label for="message">Your Message:</label>
<textarea name="message" id="message" cols="30" rows="10"></textarea>
</div>
<div class="exam">
<input type="submit" value="Submit!">
</div>
</form>
<hr>
<hr>
<!-- <input type="date" name="birthday">
<input type="time" name="game-time">
<input type="email" name="email-address">
<input type="url" name="website">
<input type="number" name="cost">
<input type="tel" name="phone-number"> -->
<div class="day">
<p>Chose a day:</p>
<select name="day" multiple>
<option value="Friday" selected>Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select>
<br>
<button name="submit">
<strong>Send Us</strong> a Message
</button>
</div>
<a href="#top">Back to top</a>
</body>
</html>