ู ูุฏู ุฉ: ุงูู ุนูู ุฃูู ู ู ุงูุดูู
- ุงูููุฑุฉ ุจุจุณุงุทุฉ ุฅู ููู ุนูุงุตุฑ HTML ู ุนููุฉ ุจูููู ูููุง ู ุนูู ุฃู ูุฏู ู ุนูู ู ุชุตู ุจููุง.
- ูุนูู ูู ุง ูููุฑ ูู ุนูุตุฑ HTML ู ุนููุ ุงูู ูุฑูุถ ู ูุจูุงุด ุจูููุฑ ุดููู ุนุงู ู ุฅุฒุงู ุนูู ุงูุตูุญุฉุ ูุฃุ ุงูู ูุฑูุถ ูููุฑ ุงูุนูุตุฑ ุฏู ู ุนูุงู ุฅูู ูุจูู ุซู ุฅูู ุจุงูุธุจุท.
- ู
ุด ูู ุงูุนูุงุตุฑ ูู HTML ูููุง ู
ุนูู (semantic).
- ุงุชููู ูุง ุนููุง ูุจู ูุฏู ูู Bold ู Italic.
- ูุงุชููู ูุง ุนููุง ูู Structuring the page HTML.
- ู
ุซูุงูุ ุงูู
<nav>
ูู ูุธููุชู ุฅูู ููุถุญ ุฅู ุฏู ุฌุฒุก ุงูู navigation.
ููุณ ุงูููุงู
ููุทุจู ุนูู ุงูู paragraphs.
ุงูู paragraph ุนุจุงุฑุฉ ุนู ุตูุฏูู ุจูุดูู ููุงู
ุ ุจุณ ููู ู
ุนูู ุฅูู ููุฑุฉ.
ู
ู
ูู ูุณุชุจุฏูู ู
ุซูุงู ุจู div
ุ ุจุณ ูู ุงูุญุงูุฉ ุฏูุ ู
ุด ููููู ููู ุฃู ู
ุนูู.
ููู ุงูู Semantic HTML ู ูู ุ
ุงุณุชุฎุฏุงู ุงูุนูุงุตุฑ ุฏู ุจู ุนูุงูุง ุงูุตุญ ู ูู ุนุดุงู:
- ู ุญุฑูุงุช ุงูุจุญุซ (Search Engines): ุจุชูุฏุฑ ุชููู ูููู ุงูู ุญุชูู ุจุชุงุนู ุจุดูู ุฃูุถู.
- ุงูู Accessibility: ุจุชุณุงุนุฏ ุงููุงุณ ุงููู ุจุชุนุชู ุฏ ุนูู screen readers ุนุดุงู ูููู ูุง ูููุฑูุง ุตูุญุงุช ุงูููุจ ุจุชุงุนุชูุง.
ุฅุฒุงู ููุตู ู ุนูู ุตูุญุฉ ุงูููุจุ (ุงูุฃุณุงูุณูุฑ ูู ุซุงู)
ูุญุฏ ุฏูููุชู ุฅูุช ุนุงุฑู ุฅู ุงูู HTML ุจููุตู ู ุญุชูู ุตูุญุฉ ุงูููุจ. ุจุณ ุฅุฒุงู ุชูุตู ู ุนูู ุงูุตูุญุฉ ุฏูุ
ุนุดุงู ูููู ุฏู ูู ุณูุงู ูุงูุนูุ ููุฑ ูู ุฒุฑุงูุฑ ุงูุฃุณุงูุณูุฑ. ู ุฌุฑุฏ ุชุฑุชูุจ ุงูุฒุฑุงูุฑ ุจุดูู ุฑุฃุณู ู ุด ููุงูุฉ ุนุดุงู ุญุฏ ูููู ู ุนูุงูุง. ุนุดุงู ููุตู ู ุนูู ุฃู ุงูู semantics ุจุชุงุนุฉ ุงูุฒุฑุงูุฑุ ุจูุถูู ุฃุฑูุงู ุนุดุงู ุงููุงุณ ุชุนุฑู ูู ุฒุฑุงุฑ ูููุฏููู ุฃููู ุฏูุฑ.
ูู ุง ุชูุชุจ HTMLุ ู ู ุงูู ู ุงุฑุณุงุช ุงููููุณุฉ ุฅูู ุชูุตู ุงูู ุญุชูู ุจุดูู semantic. ุฏู ุจูุณู ุญ ูู ุญุฑูุงุช ุงูุจุญุซ ูุจุฑุงู ุฌ ุงูู accessibility ุฒู ุงูู screen readers ุฅููุง ุชููู ู ุญุชููุงุช ุงูุตูุญุฉ.
ุนูุงุตุฑ ุงูู HTML ุงูุฃุณุงุณูุฉ ุงููู ูููุง ู ุนูู
ูุญุณู ุงูุญุธุ ู ู ูู ุชุนู ู ุฏู ุจุงุณุชุฎุฏุงู ุดููุฉ tags ุฃุณุงุณูุฉ ูู HTML ูููุง ู ุนูู:
- ู
ุซูุงูุ ุงุณุชุฎุฏุงู
Heading ุฒู
<h1>
ุจููุตู ุฅู ุงูู ุญุชูู ุฏู ุนููุงู ุฑุฆูุณู. - ุจููุณ ุงูุทุฑููุฉุ ุงูู
<ul>
ูุงูู<ol>
tags ุจุชูุตู ุงูููุงุฆู (Lists HTML). - ุจุณ ููู ุนูุงุตุฑ semantic HTML ุฃูุชุฑ ุจูุชูุฑ ู ุชุงุญุฉ ููู ูู developer.
ูู ุงูููุฏูู ุฏูุ ูุดุฑุญ ุทุฑููุฉ ู ูุธู ุฉ ู ู ูู ุชุชุจุนูุง ุนุดุงู ุชุชุฃูุฏ ุฅูู ุจุชุนู ู ุตูุญุฉ ููุจ ู ุชูููุฉ ูููุณ.
ุงููููู ุงูุฃุณุงุณู ูุตูุญุฉ HTML ู ูุธู ุฉ
ุงุชููู
ูุง ุนููุง ูุจู ูุฏุง Setting Up the HTML Document Structure ุจุณ ุฎูููุง ูุฑุงุฌุน ุงููููู ุงูุฃุณุงุณู ูุตูุญุฉ HTMLุ ุงููู ููู ุงูู head
ูุงูู body
.
ุฌูู ุงูู body
tagุ ู
ู
ูู ุชูุธู
ุงูู
ููุน ุจุงุณุชุฎุฏุงู
semantic tags ุนุดุงู ุชูุตู ูู ูุณู
.
ุจุงููุณุจุฉ ูุตูุญุฉ HTML ูู ูุฐุฌูุฉุ ุงููููู ู ู ูู ููุตูู ุจุดูู semantic ุจุงุณุชุฎุฏุงู ุงูู semantic HTML tags ุฏู:
- ุงูู
<header>
: ููุฌุฒุก ุงูุนููู ู ู ุงูุตูุญุฉ. - ุงูู
<main>
: ููู ุญุชูู ุงูุฑุฆูุณู. - ุงูู
<footer>
: ููุฌุฒุก ุงูุณููู ู ู ุงูุตูุญุฉ.
ู ุซุงู ุนูู ุชูุณูู ุฉ ุงูุตูุญุฉ:
- ูุณู
header
ููู ููุฌู ุงูุดุฑูุฉ ูุดููุฉ navigation links. - ูุณู
main
ุจูุญุชูู ุนูู sections ู articles. - ูุณู
footer
ุจูุญุชูู ุนูู ู ุนููู ุงุช ุงูุงุชุตุงู ูููููุงุช ุงูุณูุดูุงู ู ูุฏูุง.
ุชูุงุตูู ุงูุนูุงุตุฑ ุงูุฃุณุงุณูุฉ:
ุงูู <nav>
- ูุณู
ุงูู navigation ุงูุฑุฆูุณู ูู ุตูุญุชู ู
ู
ูู ุจุฑุถู ููุตูู ุจุดูู semantic ุจุงุณุชุฎุฏุงู
ุงูู
nav
tag. - ุงุชููู ูุง ุนููุง ูู Page navigation HTML
- ุนูู ุญุณุจ ุชุตู
ูู
ุงูุตูุญุฉุ ุงูู
nav
element ุบุงูุจูุง ุจูุชุญุท ุจุนุฏ ุงููheader
elementุ ูุงููheader
element ุจููุณุชุฎุฏู ุนุดุงู ุงูููุฌููุงุช. - ุงูููููุงุช ุงูุฑุฆูุณูุฉ ููู
ููุน ุจุชุชุถุงู ุฌูู ุงูู
nav
element. - ู
ู ุงูู
ู
ุงุฑุณุงุช ุงูุดุงุฆุนุฉ ุจูู ุงูู developers ุฅููู
ูุญุทูุง ุงูููููุงุช ุจุชุงุนุชูู
ูู unordered list (
<ul>
) ุฌูู ุงููnav
element ุงุชููู ูุง ุนููุง ูู (Lists HTML).
ุงูู
ุญุชูู ุงูุฑุฆูุณู: <article>
ู <section>
ุงูุนูุตุฑูู ุงูู semantic ุงูุฃุณุงุณููู ููู
ุญุชูู ุงูุฑุฆูุณู ุจุชุงุนู ูู
ุง ุงูู article
ูุงูู section
elements.
ุงูู <article>
-
ุฎูููุง ูุดูู ุงูู Article HTML ุงูุฃูู.
-
ู ูุงุตูุงุช ุงูู HTML ุจุชูููุ ุญุณุจ ู ููุน World Wide Web Consortium (W3C):
ุงูู
article
element ุจูุดูุฑ ูู ุญุชูู ุจูู ุซู ุชูููู ูุงู ู ุฃู ูุงุฆู ุจุฐุงุชู ูู ู ุณุชูุฏ ุฃู ุตูุญุฉ ุฃู ุชุทุจูู ุฃู ู ููุนุ ูุจูููู ูุงุจู ููุชูุฒูุน ุจุดูู ู ุณุชูู. -
ุงูููุงู ุฏู ู ู ูู ูููู ูุจูุฑ ุดููุฉ.
-
ู ู ูู ูุณุงุนุฏู ูู ููุฑุช ูู ุตูุญุฉ ุฌุฑูุงู. ููู ู ูุงูุงุช ูุชูุฑ ูู ุงูุตูุญุฉุ ูู ู ูู ุชูุต ุงูู ูุงูุงุช ุฏู ุจุดูู ู ููุฑุฏ ูู ุนุงูุฒ. ุงูู ูุงูุงุช ุงููู ู ู ูู ุชุดูููุง ุฏู ูู ุงูู
article
element. -
ุฃู ุซูุฉ ุนูู ุฏู ุชุดู ู:
- ุจูุณุช ูู ู ูุชุฏู (forum post)
- ู ูุงู ูู ู ุฌูุฉ ุฃู ุฌุฑูุงู
- ุชุฏูููุฉ ูู ู ุฏููุฉ (blog entry)
- ุชุนููู ู ู ู ุณุชุฎุฏู (user submitted comment)
- ุงูู interactive widget ุฃู gadget
- ุฃู ุฌุฒุก ู ุญุชูู ุชุงูู ู ุณุชูู.
-
ุฅุฒุงู ุจูุณุชุฎุฏู ุงูู
article
elementุ- ูููุฑุถ ุฅูู ุจุชุนู ู blog ุนู ุฃุฌุงุฒุฉ ุงูุตูู ุจุชุงุนุชู.
- ุงูุฃูุถู ุฅูู ุชุญุท ู
ุญุชูู ุงูู blog post ุฌูู
article
elementุ ูุฅูู ุชูููู ูุงู ู ููุงุฆู ุจุฐุงุชู ุนูู ุตูุญุฉ ุงูููุจ. - ุงูู
ูุฑูุถ ุชุญุท ุงูู
article
element ุฌูู ุงููmain
element ุจุชุงุนู. - ุจุนุฏูู ุชุถูู ุงูู heading ูุงูู paragraph tags ุงูุนุงุฏูุฉ ุฌูู ุงูู
article
element. - ุงูุณุจุจ ูู ุฅููุง ุจูุนู
ู ูุฏู ูู ุฅู ุงูู
main
element ุจูู ุซู ุจุดูู semantic ุงูู ุญุชูู ุงูุฑุฆูุณู ููุตูุญุฉ. - ูุฌูุงูุ ู
ู
ูู ูููู ููู ุฃูุชุฑ ู
ู
article
elementุ ุฒู ู ุซูุงู ูู ุญุงูุฉ ูุงุฆู ุฉ ุจู blog posts.
ุงูู <section>
- ุฏูููุชูุ ุฎูููุง ูุดูู ุงูู
section
element ูุงุชููู ูุง ุนูู Section HTML. - ู
ู
ูู ุชุถูู
section
element ุนุดุงู ุชุญุฏุฏ ุจุดูู semantic ุฃูุณุงู ู ููุตูุฉ ุฌูู ุงููarticle
. - ู ูู ููุงุญุธ: ุงูู sections ุงูู ูุฑูุถ ูููู ุฌูุงูุง heading elements ุนุดุงู ุชูุตู ุงูู section ุจุดูู semantic.
- ู
ู
ูู ุจุฑุถู ูุณุชุฎุฏู
section
elements ุนุดุงู ููุตู ุฃูุณุงู ู ุฎุชููุฉ ูู ุตูุญุฉ ุงูููุจ ุจุชุงุนุชู. ุงููsection
element ู ุด ุจูุญุชุงุฌ ูููู ุฌููarticle
element ุจุงูุถุฑูุฑุฉ. - ูู ุฏู ุจูุนุชู ุฏ ุนูู ุฅุฒุงู ุนุงูุฒ ุชูุตู ุงูุตูุญุฉ ุจุชุงุนุชู ุจุดูู semantic.
ุงูุชุฑููุจ ุงูู ุชุฏุงุฎู (Nesting) ููุนูุงุตุฑ
- ูู ุขุฎุฑ ุงูู
ุณุชูุฏ ุจููุฌู ุงูู
footer
element. ุฏู ู ู ูู ูููู ููู navigation links ุฅุถุงููุฉ ุฃู ู ุญุชูู ุชุงูู. - ู ูู ููุงุญุธ: ุงูู semantic elements ู ุด ู ุญุตูุฑุฉ ุจุณ ูู ุงููููู ุฏู.
- ูุฅู ูุฏููุง ูู ูุตู ุงูู semantics ุจุชุงุนุฉ ุงูู ุญุชููุ ูุงูุนูุงุตุฑ ุฏู ู ู ูู ุชุชุฏุงุฎู ุฌูู ุจุนุถูุง (nested)ุ ูู ุฏู ุจููุตู ุงูู ุญุชูู ุจุฏูุฉ.
ู ุซุงู ุนูู ุงูุชุฏุงุฎู:
ุฎูููุง ูุญุฏูุซ ุงูู ุซุงู ุงููู ูุงุช ุนุดุงู ูุณุชุฎุฏู ูููู semantic ู ุชุฏุงุฎู:
- ูุชุถูู
header
element ุฌูู ุงููarticle
element. - ุฌูู ุงูู
header
element ุฏูุ ุญุท:- ุงูู
heading
element ุจุชุงุน ุนููุงู ุงูู blog post. - ุงูู
paragraph
element ุจููุตู ุชุงุฑูุฎ ูุงุณู ูุงุชุจ ุงูุจูุณุช.
- ุงูู
- ุฌูู ุงูู
main
element (ุงููู ูู ุจูุญุชูู ุงููarticle
ุฃุตูุงู)ุ ุญุท ู ุญุชูู ุงูู blog post (ุฏู ู ู ูู ูููู ุฌูุง ุงููarticle
ุจุณ ุจุนุฏ ุงููheader
ุจุชุงุนู).
ุจุณ ูุฏู.
ุงูุฎูุงุตุฉ ูุงููุงูุฏุฉ
ูุฏูููุชู ุฅูุช ุนุฑูุช ุฅุฒุงู ุชูุตู ู ุญุชููุงุช ุตูุญุฉ ุงูููุจ ุจุดูู semantic. ุตูุญุงุช ุงูููุจ ุจุชุงุนุชู ุจูุช ุฃูุชุฑ accessibility ูุฅู ุงูู ุญุชูู ู ุชูุตู ุจุดูู semantic ุนุดุงู ูุถูู ู ุนูู. ุฏูููุชูุ ู ุญุฑูุงุช ุงูุจุญุซ ูุจุฑุงู ุฌ ุงูู accessibility ุชูุฏุฑ ุชููู ุจุณูููุฉ ู ุญุชููุงุช ุตูุญุฉ ุงูููุจ ุจุชุงุนุชู ุงููู ู ุชูุธู ุฉ ูููุณ.
Semantic tags in action
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Little Lemon Blog</title>
</head>
<body>
<!-- 1. Add the main header element for the page -->
<header>
<!-- 1.33: Add the logo inside the header -->
<img src="little_lemon_logo.png" alt="Little Lemon Logo">
<!-- Note: Replace 'little_lemon_logo.png' with the actual image path -->
</header>
<!-- 2. Add the navigation element -->
<nav>
<!-- 1.44: Add navigation links using an unordered list -->
<ul>
<!-- 1.52 & 2.03: Add list items with anchor tags for navigation -->
<li><a href="index.html">Home</a></li>
<li><a href="location.html">Location</a></li>
<li><a href="blog.html">Blog</a></li>
<!-- Note: Link text like 'Home', 'Location', 'Blog' added for clarity -->
</ul>
</nav>
<!-- 3. Add the main content element -->
<main>
<!-- 2.31: Add the main heading for the blog page -->
<h1>Blog</h1>
<!-- 2.39: Add the first article element for the first blog post -->
<article>
<!-- 2.52: Add the heading for the first blog post -->
<h2>20% off this weekend</h2>
<!-- 3.06: Add the paragraph content for the first blog post -->
<p>Come join us this weekend and get a 20% discount on your favorite meals!</p>
<!-- Note: Blog post text added based on context -->
</article>
<!-- 2.39: Add the second article element for the second blog post -->
<article>
<!-- 3.21: Add the heading for the second blog post -->
<h2>Our new menu</h2>
<!-- 3.31: Add the paragraph content for the second blog post -->
<p>We are excited to introduce our brand new menu. Come and explore the flavors!</p>
<!-- Note: Blog post text added based on context -->
</article>
</main>
<!-- 4. Add the footer element -->
<footer>
<!-- 3.45 & 3.52: Add a paragraph for copyright information -->
<p>© 2024 Little Lemon Restaurant. All rights reserved.</p>
<!-- Note: Used © for copyright symbol and added standard text -->
</footer>
<!-- 3.56: The blog page is now semantically described. -->
<!-- Saving (Ctrl+S / Cmd+S) and previewing would happen outside the code itself. -->
</body>
</html>
Semantic HTML cheat sheet
Semantic HTML5 Elements Explained
ุฏู ูุงูู ุฉ ุจุจุนุถ ุงูู tags ุงูู semantic ุงูุดุงุฆุนุฉ ุงููู ู ู ูู ุชุณุชุฎุฏู ูุง ูู ุดุบูู:
Sectioning tags
Use the following tags to organize your HTML document into structured sections.
<header>
: The header of a content section or the web page. Often contains branding/logo, Header HTML.<nav>
: The navigation links of a section or the web page, Page navigation HTML.<footer>
: The footer of a content section or the web page. Often contains secondary links, copyright, policy links, Footer HTML.<main>
: Specifies the main content of a section or the web page, main HTML.<aside>
: A secondary set of content, not required to understand the main content, aside HTML.<article>
: An independent, self-contained block of content (e.g., blog post, product), Article HTML.<section>
: A standalone section of the document, often used within body and article elements, Section HTML.<details>
: A collapsed section of content that can be expanded, details HTML.<summary>
: Specifies the summary or caption of a<details>
element, summary HTLM.<h1>
to<h6>
: Headings on the web page.<h1>
is most important,<h6>
is least important, Heading.
Content tags
<blockquote>
: Used to describe a quotation.<dd>
: Used to define a description for the preceding<dt>
element.<dl>
: Used to define a description list.<dt>
: Used to describe terms inside<dl>
elements.<figcaption>
: Defines a caption for a photo image (<figure>
).<figure>
: Applies markup to a photo image, often used with<figcaption>
.<hr>
: Adds a horizontal line (thematic break) to the parent element.<li>
: Used to define an item within a list (<ul>
,<ol>
,<menu>
).<menu>
: A semantic alternative to<ul>
tag for lists of commands or actions.<ol>
: Defines an ordered list.<p>
: Defines a paragraph.<pre>
: Used to represent preformatted text (preserves spaces and line breaks, often monospace font).<ul>
: Defines an unordered list.
Inline tags
Tags that apply semantics to parts of text within a block.
<a>
: An anchor link to another HTML document or URL.<abbr>
: Specifies that the containing text is an abbreviation or acronym (often with atitle
attribute for the full form).<b>
: Bolds the containing text stylistically. Use<strong>
for importance.<br>
: A line break. Moves the subsequent text to a new line.<cite>
: Defines the title of creative work (e.g., book, song, movie). Usually rendered in italics.<code>
: Indicates that the containing text is a block or snippet of computer code.<data>
: Indicates machine-readable data (often with avalue
attribute).<em>
: Emphasizes the containing text (stress emphasis). Usually rendered in italics.<i>
: The containing text is displayed in italics. Used for idiomatic text, technical terms, thoughts, etc.<mark>
: The containing text should be marked or highlighted (like using a highlighter pen).<q>
: The containing text is a short inline quotation. Browsers often add quotation marks.<s>
: Displays the containing text with a strikethrough (indicates inaccurate or no longer relevant text).<samp>
: The containing text represents sample output from a computer program.<small>
: Used to represent small text, such as copyright and legal text (side comments).<span>
: A generic inline element for grouping content, primarily for CSS styling or JS hooks, with no semantic meaning.<strong>
: Displays the containing text in bold. Used to indicate strong importance, seriousness, or urgency.<sub>
: The containing text is subscript text (displayed lower).<sup>
: The containing text is superscript text (displayed higher).<time>
: A semantic tag used to display dates, times, or durations (often with adatetime
attribute for machine-readable format).<u>
: Displays the containing text with a solid underline. Use sparingly, as it can be confused with links. Often used for non-textual annotations like spelling errors.<var>
: The containing text is a variable in a mathematical expression or programming context.
Embedded content and media tags
Tags for including external content or media.
<audio>
: Used to embed audio in web pages.<canvas>
: Used to render 2D and 3D graphics dynamically on web pages (usually via JavaScript).<embed>
: Used as a containing element for external content provided by an external application (legacy, often avoided).<iframe>
: Used to embed a nested web page (another HTML document).<img>
: Embeds an image on a web page.<object>
: Similar to<embed>
but more standardized; can embed various external resources.<picture>
: An element that contains one<img>
element and one or more<source>
elements to offer alternative images for different displays/devices (responsive images).<video>
: Embeds a video on a web page.<source>
: Specifies multiple media resources for<picture>
,<audio>
, and<video>
elements (e.g., different formats or resolutions).<svg>
: Used to define Scalable Vector Graphics within a web page.
Table tags
Tags for creating and structuring tabular data.
<table>
: Defines a table element to display table data.<thead>
: Represents the header content (group of header rows) of a table. Typically contains one or more<tr>
elements with<th>
cells.<tbody>
: Represents the main content (group of data rows) of a table. Contains one or more<tr>
elements with<td>
cells.<tfoot>
: Represents the footer content (group of footer rows) of a table. Typically contains one or more<tr>
elements with<td>
or<th>
cells.<tr>
: Represents a row in a table.<td>
: Represents a data cell in a table (standard cell).<th>
: Defines a header cell of a table (used for row or column headers).<caption>
: Defines the caption (title) of a table element. Should be the first child of<table>
.<colgroup>
: Defines a semantic group of one or more columns in a table for formatting.<col>
: Defines semantic properties for a column within a<colgroup>
. Usually empty, uses attributes likespan
.