HTML in the content layer
הוצגבשיעור הזה
| 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?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
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.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
Metatags describe the page.
What does the alt attribute of an image do?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
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?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
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?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
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.
מה השתבש? רק צוות האתר רואה זאת.