[reading note of Mozilla Structing components]
[Facts] Most webpages tend to share similar standard components. It's important to respect semantics and use the right element for the right job, because the html/css is too flexible.
"It's good to understand the overall meaning of all the HTML sectioning elements in detail."
See link here HTML element reference (not too many)
These below are so-called 'semantic elements'. <div>, <span>..
are non-semantic wrappers usually used with a suitable class
attribute, so they can be easily targeted.
<header>
<nav>
Navigation links are arranged as a list like this:
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Our Team</a></li>
<li><a href="#">Projects</a></li>
...
</ul>
</nav>
A search bar and a button as a <form>
.
<form>
<input type="search" name="q" placeholder="Search query" />
<input type="submit" value="Go!" />
</form>
'main' can only used once per page. It should be
<body> <main>
<main>
<article>
<h2>
<p></p>
<section>
<h3>
<p>a paragraph</p>
<p></p>
<section>
<h3>
<p></p>
</h3>
</section>
</h3>
</section>
</h2>
</article>
</main>
<aside>
<h2>
Related
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</h2>
</aside>
<footer>
<p>@copyright 2025 by me. All rights reserved.</p>
</footer>
- main root
html
- document metadata. (Metadata contains info about the page. This includes styles, scripts and data to indicate how to render the page. They can be inserted in the page or linked to another file)
base
, only once a page, specifies the base URL for all relative URLs in the page.head
, wraps the machine-related info (title, scripts, css).link
, tell a relationship to another file. used for css file, icons.style
, contains css style info applying to this webpage.title
, text show in the browser's tabmeta
, 'other meta data' (thoses can't be represented by base, head, etc.)
- Sectioning root
body
, only once a page, represents the content of a webpage. - Content sectioning. (allows you to organize the content into logical pieces)
address
article
aside
footer
header
h1h2h3h4h5h6
hgroup
main
nav
section
search
- Text content. (organize block or section in
body
)blockquote
dd
, description and definitiondiv
, generic container for flow content.dl
dt
figcaption
figure
hr
li
menu
ol
p
pre
ul
- Inline text semantics. (for text styles)
a
. use withhref
abbr
. abbreviation or acronym.b
,strong
. creat boldface text.bdi
. bidirection text, for multilingual.bdo
. overrides current directionality of textbr
a line break in textcode
data
dfn
, a difinition phrase or sentence.em
. test has stress emphasisi
, using italicized typekbd
, input from a keyboard, voice input, etcmark
, marked or highlighted textq
, a short inline quotationrp, rt, ruby
. for ruby annotations
. text with a strikethroughsamp
, sample output from a computer program.small
, small print, like copyright and legal text.span
, like '', but 'div' is a block-level element, whereas 'span' is an inline-level element.strong
, indicates the text has strong importance.sub, sup
, subscript or superscript for solely typographical reasons.time
, the date/time element.u
, a single solid underlinevar
, variable(s) in a mathematical expression or a programming context.wbr
, a word break.
- Image and multimedia (image, audio, and video)
area
, used only within 'map'audio
,image
map
, define an image map(a clickable link area)track
, text track (subtitles) for audio and video.video
,
- embedded content (In addition to regular multimedia content)
embeded
fencedframe
iframe
represent a nested browsing context, eg. a map.object
, an external resource, eg. a pdf, videopicture
, contain multiple 'source' and 'img' to e.g. adapt to different device.portal
, enables antoher webpage to have smoother navigation into new pages.source
- SVG and MathML
svg
math
- Scripting (to create dynamic content and web applications)
canvas
noscript
script
- Demarcating edits
del
ins
- Table content
caption
col
colgroup
table
tbody
td
tfoot
th
thead
tr
- Form (forms arhe that users can fill out and submit to the website)
button
datalist
fieldset
form
input
label
legend
meter
optgroup
option
output
progress
select
textarea
- interactive elements ()
details
dialog
summary
- Web Components
slot
template