HTML in the content layer
Đã giới thiệuTrong bài học này
| 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?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
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.
Độ khó 2/5 · 140 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Metatags describe the page.
What does the alt attribute of an image do?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
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?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
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?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
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.
Đã xảy ra vấn đề gì? Chỉ đội ngũ trang web nhìn thấy thông tin này.