HTML in the content layer
IntroducidoEn esta lección
| 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?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
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.
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
Metatags describe the page.
What does the alt attribute of an image do?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
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?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
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?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
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.
¿Qué salió mal? Solo el equipo del sitio ve esta información.