HTML in the content layer
IntroduitDans cette leçon
| English |
|---|
| metatag |
| stylesheet |
| viewport |
| anchor/ˈæŋkə/ |
Writing the content
- HTML builds the content layer. The exam asks you to write and edit tags for structure, media and links.
Head and body
- The head holds information about the page:
<title>, metatags 元标签, attached stylesheets 样式表, the default link target. - The body holds the displayed content.
- Metatags: charset, description, keywords, author, viewport 视口.
- With several stylesheets equally specific, the one attached last wins.
Where does the page title shown in the browser tab go?
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
The head holds information about the page.
Body elements
<h1>–<h3>,<p>; lists<ol>,<ul>,<li>.- Tables
<table>,<tr>,<th>,<td>;colspan,rowspan; sizes in px or %. <img src alt width height>;<video controls>,<audio controls>;<div class>groups elements.
Match each metatag to its purpose.
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
Metatags describe the page.
What does the alt attribute of an image do?
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Alternative text.
Bookmarks and hyperlinks
- Bookmark:
<h2 id="fees">. Link with an anchor 锚点<a>:
| to | code |
|---|---|
| bookmark | <a href="#fees"> |
| local page | <a href="contact.html"> |
| website | <a href="https://…"> |
<a href="mailto:…"> |
target="_blank"opens a new window;"_self"the same one; or a named window.
Which code links to a bookmark id="fees" on the same page?
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
The # marks a bookmark.
File paths
- Relative:
images/logo.png, from the current page. Absolute:C:/Users/…, one computer only. - Use relative paths so links survive uploading.
Why should local pages use relative file paths?
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
An absolute path points to one computer's folders.
Always give images alt text. It is needed for accessibility and when images fail to load.
Head = information about the page (title, metatags, stylesheets); body = content. Use correct tags for text, lists, tables and media; link with <a href> and id bookmarks; use relative paths.
Que s’est-il passé ? Seule l’équipe du site voit ces informations.