-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml5.html
More file actions
340 lines (303 loc) · 17.9 KB
/
html5.html
File metadata and controls
340 lines (303 loc) · 17.9 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HTML5 Tutorial</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>
<nav>
<ul class="navMenu">
<li><a href="index.html">Main page</a></li>
<li class="menuActive"><a href="html5.html">HTML5</a></li>
<li><a href="javascript.html">JavaScript</a></li>
<li><a href="ajax.html">Ajax</a></li>
<li><a>Quizzes</a>
<ul class="dropDownMenu">
<li><a href="quiz1.html">Quiz1</a></li>
<li><a href="quiz2.html">Quiz2</a></li>
<li><a href="quiz3.html">Quiz3</a></li>
</ul>
</li>
</ul>
</nav>
<main>
<h2>HTML</h2>
<section>
<h3>Page-structure elements</h3>
<p>These elements are new to HTML5 and now it is recommended to use them to define web page structure instead of div elements, and of course
instead of HTML tables. Most browsers will display the page-structure elements with the block display value.
</p>
<div class="imageContainer">
<img src="page-structure_HTML5_elements.jpg" alt="HTML5 stucture elements"/><br>
<p>New HTML5 page-stucture elements. Source <a href="https://www.w3schools.com/html/html5_semantic_elements.asp">W3Schools</a></p>
</div>
<h4><article> element</h4>
<p>The <article> tag specifies independent, self-contained content. An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.
Potential sources for the <article> element:
<ul>
<li>Forum post </li>
<li>Blog post </li>
<li>News story </li>
<li>Comment</li>
</ul>
</p>
<h4><aside> element</h4>
<p>The <aside> tag defines some content aside from the content it is placed in.
The aside content should be related to the surrounding content and could be placed as a sidebar in an article.
</p>
<h4><header> element</h4>
<p>The <header> element specifies a header for a document or section. The <header> element should be used as a container for introductory content.
You can have several <header> elements in one document.
</p>
<h4><section> element</h4>
<p>The <section> tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document.
</p>
<h4><details> element</h4>
<p>The <details> tag specifies additional details that the user can view or hide on demand.
The <details> tag can be used to create an interactive widget that the user can open and close. Any sort of content can be put inside the <details> tag.
The content of a <details> element should not be visible unless the open attribute is set.
The <summary> tag is used to specify a visible heading for the details. The heading can be clicked to view/hide the details.<br>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<details> <br>
<summary>Copyright 1999-2018.</summary><br>
<p> - by Refsnes Data. All Rights Reserved. </p><br>
<p> All content and graphics on this web site are the property of the company Refsnes Data.</p><br>
</details><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<details>
<summary>Copyright 1999-2018.</summary>
<p> - by Refsnes Data. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
</details>
</div>
</div>
</p>
</section>
<section>
<h3>HTML5 input types</h3>
<p>The <form> tag is used to create an HTML form for user input. Form elements are different types of input elements, checkboxes, radio buttons, submit buttons, and more.
It can contain one or more of the following form elements:
<ul>
<li><input></li>
<li><textarea></li>
<li><button></li>
<li><select></li>
<li><option></li>
<li><optgroup></li>
<li><fieldset></li>
<li><label></li>
</ul>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form action="#" method="GET"><br>
First name: <input type="text" name="firstName"><br>
Last name: <input type="text" name="lastName"><br>
<input type="submit" value="Submit"><br>
</form><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<form action="#" method="GET">
First name: <input type="text" name="firstName"><br>
Last name: <input type="text" name="lastName"><br>
<input type="submit" value="Submit"><br>
</form>
</div>
</div>
<p><span><input></span> elements provide web developers with a plethora of options depending on the type attribute. Let's review most
frequently used input types.</p>
</p>
<h4><select> element (drop-down list)</h4>
<p>The <select> tag defines a drop-down list and allows to define a list of options to select with <option> element. Note, that
usually the first option is selected by default, however you can select the option you want by adding the attribute selected to a desired option.</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<select name="cars"><br>
<option value="volvo">Volvo</option><br>
<option value="saab" selected>Saab</option><br>
<option value="fiat">Fiat</option><br>
<option value="audi">Audi</option><br>
</select><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab" selected>Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</div>
</div>
<h4><datalist> element (drop-down list)</h4>
<p>The <datalist> element specifies a list of pre-defined options for an <input> element.
Users will see a drop-down list of pre-defined options as they input data.
The list attribute of the <input> element, must refer to the id attribute of the <datalist> element.</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form action="#"><br>
<input list="browsers"><br>
<datalist id="browsers"><br>
<option value="Internet Explorer"><br>
<option value="Firefox"><br>
<option value="Chrome"><br>
<option value="Opera"><br>
<option value="Safari"><br>
</datalist><br>
</form>
</div>
<label>Results</label><br>
<div class="resultExample">
<form action="#">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
</div>
</div>
<h4>Input type password</h4>
<p>HTML5 introduced a special input type for user passwords. All entered symbols are masked with asterisks.</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form><br>
User name:<br>
<input type="text" name="userName"><br>
User password:<br>
<input type="password" name="password"><br>
</form><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<form>
User name:<br>
<input type="text" name="userName"><br>
User password:<br>
<input type="password" name="password">
</form>
</div>
</div>
<h4>Input type radio</h4>
<p>HTML5 offers an input type called radio button that allows to choose only one option. Make sure that all options have the same name attribute,
or otherwise users will be able to choose more than one option.</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form><br>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other<br>
</form>
</div>
<label>Results</label><br>
<div class="resultExample">
<form>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
</div>
</div>
<h4>Input type text</h4>
<p>Input type equal to text defines a one-line input field for text input.</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form><br>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname"><br>
</form><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<form>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
</form>
</div>
</div>
<h4>Input type number</h4>
<p>Number input type provides web developers with a tool that can be used for numeric user input. It also allows to apply restrictions, such as
the minimum and the maximum values, increment value and others. Please note that these additional restrictions can vary depending on the browser,
so you will need to check browser documentation first.
</p>
<h5>Example</h5>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form><br>
<label>1 sec</label><br>
<input type="range" id="slideshowSpeed" min="1" max="20" step="1" value="3" /><br>
<label>20 sec</label><br>
</form><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<form>
<label>1 sec</label>
<input type="range" id="slideshowSpeed" min="1" max="20" step="1" value="3" />
<label>20 sec</label>
</form>
</div>
</div>
<h4>Input type submit and reset</h4>
<p>HTML5 introduced two new button types, with submit and reset input types. The submit button allows users to submit data entered to input
fields to the script specified in the form action attribute. Please note that in order the submit button to work properly,
all fields must have names attributes. The reset button clears all the fields and leaves them blank when it pressed.
</p>
<div class="example">
<label>HTML code</label><br>
<div class="codeExample">
<form action="#" method="GET"><br>
First name: <input type="text" name="firstName"><br>
Last name: <input type="text" name="lastName"><br>
<input type="submit" value="Submit"><br>
<input type="reset" value="Clear fields"><br>
</form><br>
</div>
<label>Results</label><br>
<div class="resultExample">
<form action="#" method="GET">
First name: <input type="text" name="firstName"><br>
Last name: <input type="text" name="lastName"><br>
<input type="submit" value="Submit">
<input type="reset" value="Clear fields"><br>
</form>
</div>
</div>
<p class="source">Materials and examples from <a href="https://www.w3schools.com/html/html_form_input_types.asp">W3schools.com</a> were used for this page</p>
</section>
<div class="buttonsContainer">
<a href="quiz1.html"><button class="mainPageButton">Start quiz</button></a>
</div>
</main>
<footer>
© Kirill Golubev 2018
</footer>
</body>