Skip to Content
MOBILE HTML5學習手冊
book

MOBILE HTML5學習手冊

by Estelle Weyl
June 2014
Intermediate to advanced
488 pages
9h 56m
Chinese
GoTop Information, Inc.
Content preview from MOBILE HTML5學習手冊
升級為 HTML5
|
39
使用最符合語義的元素
XHTML 中,你必須按照語義來編寫元素,段落裡面不能有表格與表單。如果你
要把表單元素當成詞彙元素,必須把它放在語義為區塊等級的元素裡面,例如段落
或表格的儲存格。是的,你可以在網頁中使用
span
div
來容納所有東西,但如果
你的 header 是標題,請使用
<h1-6>
標籤。
必要的元件
元素是構成 Web 的磚塊。如果網站沒有內容,CSS JavaScript 就沒有增強效果的對
象。但是實際上,一個合法的 XHTML 只要五個元件:
文字類型宣告,或 DTD
HTML 根元素:
<html></html>
文件標頭,
html: <head></head>
的直系子元素
文件標題,位於
head: <title></title>
之中
文件本文,
html: <body></body>
的直系子元素
換句話說,如果使用 XHTML 語法,最簡單的合法 HTML5 文件會是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Blank Document</title>
</head>
<body>
</body>
</html>
我在上面加入
charset <meta>
元素,如果你的伺服器設定了正確的 HTTP 標題的話,就
不一定要使用它。如果你無法控制伺服器,一定要使用它。
事實上,HTML5 的合法文件甚至不需要這麼多元素。如果你省略
<html>
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JAVASCRIPT網頁應用程式設計

JAVASCRIPT網頁應用程式設計

Alex MacCaw

Publisher Resources

ISBN: 9789863471240