Skip to content

Commit a93eb4a

Browse files
authored
Merge pull request #74 from Tirth-chokshi/main
added semantic html
2 parents 96f94ac + ef3d455 commit a93eb4a

File tree

3 files changed

+269
-3
lines changed

3 files changed

+269
-3
lines changed

docs/html/semantic-html/benefits-of-semantic-html.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,60 @@ sidebar_label: Benefits of Semantic HTML
55
sidebar_position: 3
66
tags: [html, web-development, semantic-html, benefits-of-semantic-html]
77
description: In this tutorial, you will learn about the benefits of using semantic HTML to improve the accessibility, search engine optimization (SEO), and maintainability of your web pages.
8-
---
8+
---
9+
10+
# Benefits of Semantic HTML
11+
12+
Semantic HTML plays a crucial role in web development, offering a range of benefits that enhance the user experience, improve search engine optimization (SEO), and facilitate easier website maintenance. By using semantic tags, developers can create web pages that are more accessible, understandable, and efficient.
13+
14+
## Enhanced Accessibility
15+
16+
Semantic HTML elements such as `<header>`, `<nav>`, `<article>`, `<section>`, `<aside>`, and `<footer>` provide meaningful structure to web content, making it easier for assistive technologies like screen readers to interpret and navigate the page.
17+
18+
**Example:**
19+
20+
```html
21+
<article>
22+
<h2>Article Title</h2>
23+
<p>Article content...</p>
24+
</article>
25+
```
26+
27+
This `<article>` tag indicates that the enclosed content is an independent, self-contained composition, which helps assistive devices understand its context.
28+
29+
## Improved SEO
30+
31+
Search engines prioritize content that is well-structured and semantically meaningful. By using semantic HTML, developers can ensure that their content is indexed more effectively, leading to better search engine rankings.
32+
33+
**Example:**
34+
35+
```html
36+
<section>
37+
<h2>Section Heading</h2>
38+
<p>Section content...</p>
39+
</section>
40+
```
41+
42+
A `<section>` tag denotes a specific section of content, making it easier for search engines to understand the webpage's structure and content hierarchy.
43+
44+
## Easier Maintenance and Code Readability
45+
46+
Semantic HTML makes web pages easier to read and maintain. By clearly defining the role of each part of a webpage, developers can quickly understand and modify the code, even if they are not the original authors.
47+
48+
**Example:**
49+
50+
```html
51+
<footer>
52+
<p>Copyright © Your Website 2024</p>
53+
</footer>
54+
```
55+
56+
A `<footer>` tag clearly marks the end of a page and its content, simplifying the task of updating footer information across multiple pages.
57+
58+
## Cross-Compatibility and Future-Proofing
59+
60+
Websites built with semantic HTML are more likely to be compatible across different browsers and devices. Additionally, as web standards evolve, semantic HTML ensures that content remains accessible and functional.
61+
62+
## Conclusion
63+
64+
The benefits of semantic HTML are clear: enhanced accessibility, improved SEO, easier maintenance, and better cross-compatibility. By adopting semantic HTML in web development projects, developers can create more efficient, accessible, and future-proof websites.

docs/html/semantic-html/semantic-html5-elements.md

Lines changed: 180 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,183 @@ sidebar_label: Semantic HTML5 Elements
55
sidebar_position: 2
66
tags: [html, web-development, semantic-html, semantic-html5-elements]
77
description: In this tutorial, you will learn about semantic HTML5 elements and how they can improve the structure, accessibility, and search engine optimization (SEO) of your web pages.
8-
---
8+
---
9+
10+
Semantic HTML5 elements provide meaning to web content beyond mere presentation. They help in creating accessible and search engine friendly web pages by clearly defining the structure and purpose of different parts of web content.
11+
12+
## Common Semantic HTML5 Elements
13+
Semantic elements in HTML5 are those that clearly describe their meaning in a human- and machine-readable way. Elements such as `<article>`, `<aside>`, `<details>`, `<figcaption>`, `<figure>`, `<footer>`, `<header>`, `<main>`, `<mark>`, `<nav>`, `<section>`, `<summary>`, and `<time>` not only help in structuring the content but also define its purpose on the web page.
14+
15+
<table>
16+
<tbody>
17+
<tr>
18+
<th>Tag</th>
19+
<th>Description</th>
20+
</tr>
21+
<tr>
22+
<td><a href="/docs/html/semantic-html/semantic-html5-elements#article">&lt;article&gt;</a></td>
23+
<td>Defines independent, self-contained content</td>
24+
</tr>
25+
<tr>
26+
<td><a href="/docs/html/semantic-html/semantic-html5-elements#aside">&lt;aside&gt;</a></td>
27+
<td>Defines content aside from the page content</td>
28+
</tr>
29+
<tr>
30+
<td><a href="/docs/html/semantic-html/semantic-html5-elements#footer">&lt;footer&gt;</a></td>
31+
<td>Defines a footer for a document or section</td>
32+
</tr>
33+
<tr>
34+
<td><a href="/docs/html/semantic-html/semantic-html5-elements#header">&lt;header&gt;</a></td>
35+
<td>Specifies a header for a document or section</td>
36+
</tr>
37+
<tr>
38+
<td><a href="/docs/html/semantic-html/semantic-html5-elements#nav">&lt;nav&gt;</a></td>
39+
<td>Defines navigation links</td>
40+
</tr>
41+
</tbody>
42+
</table>
43+
44+
### `<article>`
45+
46+
Defines independent, self-contained content that could be distributed and reused (e.g., in syndication).
47+
48+
<Tabs>
49+
<TabItem value="HTML">
50+
```html
51+
<article>
52+
<h2>Article Title</h2>
53+
<p>Article content...</p>
54+
</article>
55+
```
56+
</TabItem>
57+
<TabItem value="Output">
58+
<BrowserWindow url="http://127.0.0.1:5500/article.html">
59+
<div>
60+
<article>
61+
<h2>Article Title</h2>
62+
<p>Article content...</p>
63+
</article>
64+
</div>
65+
</BrowserWindow>
66+
</TabItem>
67+
</Tabs>
68+
69+
### `<aside>`
70+
71+
Defines content aside from the content it is placed in (like a sidebar). The content should be related to the surrounding content.
72+
73+
<Tabs>
74+
<TabItem value="HTML">
75+
```html
76+
<aside>
77+
<p>Sidebar content or related links</p>
78+
</aside>
79+
```
80+
</TabItem>
81+
<TabItem value="Output">
82+
<BrowserWindow url="http://127.0.0.1:5500/aside.html">
83+
<div>
84+
<aside>
85+
<p>Sidebar content or related links</p>
86+
</aside>
87+
</div>
88+
</BrowserWindow>
89+
</TabItem>
90+
</Tabs>
91+
92+
### `<footer>`
93+
94+
Defines a footer for a document or a section. It typically contains authorship information, copyright notices, and links to privacy policies.
95+
96+
<Tabs>
97+
<TabItem value="HTML">
98+
```html
99+
<footer>
100+
<p>Copyright © Your Website 2024</p>
101+
</footer>
102+
```
103+
</TabItem>
104+
<TabItem value="Output">
105+
<BrowserWindow url="http://127.0.0.1:5500/footer.html">
106+
<div>
107+
<footer>
108+
<p>Copyright © Your Website 2024</p>
109+
</footer>
110+
</div>
111+
</BrowserWindow>
112+
</TabItem>
113+
</Tabs>
114+
115+
### `<header>`
116+
117+
Defines a header for a document or a section. It typically contains introductory content or navigation links.
118+
119+
<Tabs>
120+
<TabItem value="HTML">
121+
```html
122+
<header>
123+
<h1>Website Title</h1>
124+
<nav>
125+
<ul>
126+
<li><a href="#">Home</a></li>
127+
<li><a href="#">About</a></li>
128+
<li><a href="#">Contact</a></li>
129+
</ul>
130+
</nav>
131+
</header>
132+
```
133+
</TabItem>
134+
<TabItem value="Output">
135+
<BrowserWindow url="http://127.0.0.1:5500/header.html">
136+
<div>
137+
<header>
138+
<h1>Website Title</h1>
139+
<nav>
140+
<ul>
141+
<li><a href="#">Home</a></li>
142+
<li><a href="#">About</a></li>
143+
<li><a href="#">Contact</a></li>
144+
</ul>
145+
</nav>
146+
</header>
147+
</div>
148+
</BrowserWindow>
149+
</TabItem>
150+
</Tabs>
151+
152+
### `<nav>`
153+
154+
Defines navigation links, making it easier for users to navigate through the website. It is intended for major blocks of navigation links.
155+
156+
<Tabs>
157+
<TabItem value="HTML">
158+
```html
159+
<nav>
160+
<ul>
161+
<li><a href="#home">Home</a></li>
162+
<li><a href="#news">News</a></li>
163+
<li><a href="#contact">Contact</a></li>
164+
<li><a href="#about">About</a></li>
165+
</ul>
166+
</nav>
167+
```
168+
</TabItem>
169+
<TabItem value="Output">
170+
<BrowserWindow url="http://127.0.0.1:5500/nav.html">
171+
<div>
172+
<nav>
173+
<ul>
174+
<li><a href="#home">Home</a></li>
175+
<li><a href="#news">News</a></li>
176+
<li><a href="#contact">Contact</a></li>
177+
<li><a href="#about">About</a></li>
178+
</ul>
179+
</nav>
180+
</div>
181+
</BrowserWindow>
182+
</TabItem>
183+
</Tabs>
184+
185+
## Conclusion
186+
187+
Semantic HTML5 elements are crucial for creating web pages that are accessible, SEO-friendly, and easy to maintain. By using these elements appropriately, developers can ensure that their web content is structured in a way that benefits users, search engines, and their own maintenance workflows.

docs/html/semantic-html/understanding-semantic-html.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,35 @@ sidebar_label: Understanding Semantic HTML
55
sidebar_position: 1
66
tags: [html, web-development, semantic-html]
77
description: In this tutorial, you will learn about semantic HTML and how it can improve the accessibility, search engine optimization (SEO), and maintainability of your web pages.
8-
---
8+
---
9+
10+
Semantic HTML refers to HTML that introduces meaning to the web page rather than just presentation. Using semantic tags gives the web page a structured and meaningful layout, which helps search engines to index the page better and improves accessibility for users with assistive technologies.
11+
12+
## What is Semantic HTML?
13+
14+
Semantic HTML or semantic markup is HTML that introduces meaning to the web page rather than just presentation. It uses HTML tags that give information about the contents of those tags that goes beyond just how they look on the page.
15+
16+
:::info
17+
Semantic HTML elements clearly describe their meaning in a human- and machine-readable way. Elements such as `<header>`, `<footer>`, `<article>`, and `<section>` not only structure the content but also define its purpose.
18+
:::
19+
20+
## Importance of Semantic HTML
21+
22+
1. **Accessibility**: Semantic HTML plays a crucial role in accessibility. Screen readers and other assistive technologies rely on the structure of the document to navigate and interpret the content correctly.
23+
24+
2. **SEO**: Search engines give higher importance to the content within semantic markup, as it clearly defines its context and relevance. This can lead to better search engine rankings.
25+
26+
3. **Maintainability**: Websites built with semantic HTML are easier to maintain and update. The clear structure makes it easier for developers to understand and modify the code.
27+
28+
## Common Semantic HTML Elements
29+
30+
- **`<header>`**: Defines a header for a document or a section.
31+
- **`<footer>`**: Specifies a footer for a document or section.
32+
- **`<article>`**: Defines independent, self-contained content.
33+
- **`<section>`**: Represents a generic section of a document or application.
34+
- **`<nav>`**: Defines navigation links.
35+
- **`<aside>`**: Marks content that is tangentially related to the content around it.
36+
37+
## Conclusion
38+
39+
Semantic HTML is essential for creating web pages that are accessible, easily maintained, and optimized for search engine rankings. By using semantic elements, developers can create web pages that not only look good but also provide a better user experience and are more inclusive. As web standards evolve, the importance of semantic HTML will continue to grow, making it a critical aspect of modern web development.

0 commit comments

Comments
 (0)