1. html5 的語(yǔ)法結(jié)構(gòu)
<!doctype html >
<html>
<head>
<meta charset="UTF-8">
<title> 網(wǎng)頁(yè) </title>
<link ref="stylesheet " href=" style.css" >
<script src="script.js"></script>
<base src="./ ">
<head>
<body>
<h1>this is a head </h1>
<p> this is a paragraph</p>
<p>
today is a good day. it's sunny.
<img src="weather.jpg">
</p>
</body>
</html>
2. Html, Css , JavaScript 分別起什么作用
3. html5 是如何工作的
- 瀏覽器加載一個(gè)由 html 和 css 寫(xiě)的文檔
document
markup written in HTML
style written in CSS
the browser loads a document, including markup written in HTML and style written in CSS
- 當(dāng)瀏覽器加載你的網(wǎng)頁(yè)的同時(shí), 內(nèi)部創(chuàng)建了一個(gè) 你的文檔模型, 該模型包含了 html 標(biāo)記語(yǔ)言的全部元素。
model of your document
一個(gè)表示 html 元素的樹(shù)結(jié)構(gòu)對(duì)象羊始, 我們稱(chēng)這個(gè)樹(shù)為 Document Object Model , 簡(jiǎn)稱(chēng) DOM
- 當(dāng)瀏覽器加載網(wǎng)頁(yè)的時(shí)候磺箕, 同時(shí)也加載了 javaScript 代碼纯出, 只是一般在網(wǎng)頁(yè)加載后執(zhí)行
你可以使用 javaScript 操控 DOM 與網(wǎng)頁(yè)交互猴鲫, 對(duì)用戶(hù)和瀏覽器事件做出響應(yīng), 或者使用新的JavaScript API 接口與用戶(hù)交互滞详。
- 通過(guò)API 可以訪(fǎng)問(wèn) audio video 2D drawing with the canvas , local storage 和其他需要?jiǎng)?chuàng)建app 的技術(shù)
API 即 Application 凛俱, Programming Interfaces
暴露一些 objects 喘落, methods , properties 最冰,我們能夠通過(guò)他們?cè)L問(wèn)這些技術(shù)的所有功能瘦棋。
Bulliet Points
<script> tag 或者 in a stylesheet link to CSS , 不再需要 type 屬性, JavaScript 和 CSS 是默認(rèn)使用的暖哨。
html5 中的許多新特性需要使用 javaScript
使用 JavaScript 能與 DOM 交互 赌朋。DOM , Document Object Model
DOM 是網(wǎng)頁(yè)的內(nèi)部表示篇裁, 使用 JavaScript 你能訪(fǎng)問(wèn)元素沛慢,改變?cè)卦黾有略氐?DOM
JavaScript API 是一個(gè)應(yīng)用編程接口,API 能夠控制html5 的方方面面达布,例如 2D drawing 团甲, video playback 等。