-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample9.html
260 lines (217 loc) · 9.4 KB
/
example9.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5 Tags</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1,
h2 {
color: #444;
}
pre {
background-color: #e9e9e9;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
}
.section {
margin-bottom: 40px;
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 10px;
}
.example {
background-color: #e9f7ef;
padding: 10px;
border: 1px solid #27ae60;
border-radius: 5px;
}
.form-example {
margin-top: 20px;
padding: 15px;
background-color: #f3f3f3;
border: 1px solid #ddd;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>HTML5 Tags</h1>
<div class="section">
<h2>Basic Tags</h2>
<p>HTML5 introduces several new semantic elements that help structure web content. Here are some of the basic tags:</p>
<h3><!DOCTYPE></h3>
<p>The <!DOCTYPE> declaration defines the document type and version of HTML being used. For HTML5, it is written as:</p>
<pre><code><!DOCTYPE html></code></pre>
<h3><html></h3>
<p>The <code><html></code> tag is the root element of an HTML page. It wraps all the content on the page.</p>
<pre><code><html lang="en">
<head>...</head>
<body>...</body>
</html></code></pre>
<h3><head></h3>
<p>The <code><head></code> element contains meta-information about the document, such as its title, character set, and linked resources.</p>
<pre><code><head>
<meta charset="UTF-8">
<title>Page Title</title>
</head></code></pre>
<h3><body></h3>
<p>The <code><body></code> tag contains the content of the document, such as text, images, and other media.</p>
<pre><code><body>
<h1>Hello, World!</h1>
<p>Welcome to my webpage.</p>
</body></code></pre>
</div>
<div class="section">
<h2>Text Content Tags</h2>
<p>HTML5 provides various tags for structuring text content:</p>
<h3><h1> to <h6></h3>
<p>Heading tags range from <code><h1></code> (most important) to <code><h6></code> (least important).</p>
<pre><code><h1>Main Heading</h1>
<h2>Sub Heading</h2></code></pre>
<h3><p></h3>
<p>The <code><p></code> tag defines a paragraph of text.</p>
<pre><code><p>This is a paragraph.</p></code></pre>
<h3><blockquote></h3>
<p>The <code><blockquote></code> tag is used for long quotations.</p>
<pre><code><blockquote>
<p>This is a quote from someone important.</p>
</blockquote></code></pre>
<h3><strong> and <em></h3>
<p>The <code><strong></code> tag emphasizes text with strong importance, while <code><em></code> emphasizes text with normal importance.</p>
<pre><code><strong>Important text</strong>
<em>Emphasized text</em></code></pre>
</div>
<div class="section">
<h2>Structural Tags</h2>
<p>HTML5 introduces new structural tags to enhance the semantic meaning of web pages:</p>
<h3><header></h3>
<p>The <code><header></code> tag represents introductory content, typically containing headings, logos, and navigation.</p>
<pre><code><header>
<h1>Website Title</h1>
<nav>...</nav>
</header></code></pre>
<h3><nav></h3>
<p>The <code><nav></code> tag defines a set of navigation links.</p>
<pre><code><nav>
<a href="home.html">Home</a>
<a href="about.html">About</a>
</nav></code></pre>
<h3><main></h3>
<p>The <code><main></code> tag specifies the main content of a document, excluding headers, footers, and sidebars.</p>
<pre><code><main>
<article>...</article>
</main></code></pre>
<h3><footer></h3>
<p>The <code><footer></code> tag defines a footer for a document or section.</p>
<pre><code><footer>
<p>Copyright © 2024</p>
</footer></code></pre>
</div>
<div class="section">
<h2>Media Tags</h2>
<p>HTML5 enhances support for audio and video content:</p>
<h3><audio></h3>
<p>The <code><audio></code> tag is used to embed sound content in documents.</p>
<pre><code><audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio></code></pre>
<h3><video></h3>
<p>The <code><video></code> tag is used to embed video content.</p>
<pre><code><video width="320" height="240" controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video></code></pre>
</div>
<div class="section">
<h2>Interactive Elements</h2>
<p>HTML5 introduces new interactive elements:</p>
<h3><canvas></h3>
<p>The <code><canvas></code> tag is used to draw graphics on the fly via scripting (usually JavaScript).</p>
<pre><code><canvas id="myCanvas" width="200" height="100"></canvas></code></pre>
<h3><details> and <summary></h3>
<p>The <code><details></code> tag creates a disclosure widget from which the user can obtain additional information or controls. The <code><summary></code> tag provides a summary or title for the details.</p>
<pre><code><details>
<summary>More information</summary>
<p>Here is some more information.</p>
</details></code></pre>
</div>
<div class="section">
<h2>Form Elements</h2>
<p>HTML5 includes several new input types for forms:</p>
<h3><input> Types</h3>
<p>New input types include:</p>
<ul>
<li><strong>email</strong>: Validates the input to ensure it's an email address.</li>
<li><strong>url</strong>: Validates the input to ensure it's a URL.</li>
<li><strong>date</strong>: Provides a date picker.</li>
<li><strong>range</strong>: Creates a slider control.</li>
</ul>
<div class="form-example">
<h3>Example of Input Types</h3>
<form>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>
<label for="website">Website:</label>
<input type="url" id="website" name="website" required><br><br>
<label for="date">Choose a date:</label>
<input type="date" id="date" name="date"><br><br>
<label for="volume">Volume:</label>
<input type="range" id="volume" name="volume" min="0" max="100"><br><br>
<input type="submit" value="Submit">
</form>
</div>
</div>
<div class="section">
<h2>Semantic Tags</h2>
<p>Semantic tags give meaning to the web content and improve accessibility:</p>
<h3><article></h3>
<p>The <code><article></code> tag specifies independent, self-contained content.</p>
<pre><code><article>
<h2>Article Title</h2>
<p>This is the content of the article.</p>
</article></code></pre>
<h3><section></h3>
<p>The <code><section></code> tag defines a section of content, typically with a heading.</p>
<pre><code><section>
<h2>Section Title</h2>
<p>This is a section of content.</p>
</section></code></pre>
<h3><aside></h3>
<p>The <code><aside></code> tag represents content related to the surrounding content, like a sidebar.</p>
<pre><code><aside>
<p>This is an aside content.</p>
</aside></code></pre>
</div>
<div class="section">
<h2>Table Tags</h2>
<p>HTML5 tables allow for structured data presentation:</p>
<h3><table></h3>
<p>The <code><table></code> tag is used to create a table.</p>
<pre><code><table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table></code></pre>
</div>
<div class="section">
<h2>Conclusion</h2>
<p>HTML5 brings a wealth of new tags and features that enhance the semantic meaning and functionality of web pages. Understanding these tags allows for better structuring of content and improved accessibility.</p>
</div>
</body>
</html>