1. html5 的語法結(jié)構(gòu)
<!doctype html >
<html>
<head>
<meta charset="UTF-8">
<title> 網(wǎng)頁 </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 寫的文檔
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)頁的同時(shí), 內(nèi)部創(chuàng)建了一個(gè) 你的文檔模型, 該模型包含了 html 標(biāo)記語言的全部元素。
model of your document
一個(gè)表示 html 元素的樹結(jié)構(gòu)對(duì)象, 我們稱這個(gè)樹為 Document Object Model , 簡(jiǎn)稱 DOM
- 當(dāng)瀏覽器加載網(wǎng)頁的時(shí)候, 同時(shí)也加載了 javaScript 代碼, 只是一般在網(wǎng)頁加載后執(zhí)行
你可以使用 javaScript 操控 DOM 與網(wǎng)頁交互, 對(duì)用戶和瀏覽器事件做出響應(yīng), 或者使用新的JavaScript API 接口與用戶交互。
- 通過API 可以訪問 audio video 2D drawing with the canvas , local storage 和其他需要?jiǎng)?chuàng)建app 的技術(shù)
API 即 Application , Programming Interfaces
暴露一些 objects , methods , properties ,我們能夠通過他們?cè)L問這些技術(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)頁的內(nèi)部表示, 使用 JavaScript 你能訪問元素,改變?cè)卦黾有略氐?DOM
JavaScript API 是一個(gè)應(yīng)用編程接口,API 能夠控制html5 的方方面面,例如 2D drawing , video playback 等。