第 1 章 html5 怎么工作的

2020-08-25  本文已影响0人  晨曦Bai

1. html5 的语法结构

<!doctype html >
<html>
   <head>
      <meta charset="UTF-8">
      <title> 网页 </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 是如何工作的

  1. 浏览器加载一个由 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

  1. 当浏览器加载你的网页的同时, 内部创建了一个 你的文档模型, 该模型包含了 html 标记语言的全部元素。

model of your document
一个表示 html 元素的树结构对象, 我们称这个树为 Document Object Model , 简称 DOM

  1. 当浏览器加载网页的时候, 同时也加载了 javaScript 代码, 只是一般在网页加载后执行

你可以使用 javaScript 操控 DOM 与网页交互, 对用户和浏览器事件做出响应, 或者使用新的JavaScript API 接口与用户交互。

  1. 通过API 可以访问 audio video 2D drawing with the canvas , local storage 和其他需要创建app 的技术

API 即 Application , Programming Interfaces
暴露一些 objects , methods , properties ,我们能够通过他们访问这些技术的所有功能。

Bulliet Points

  1. <script> tag 或者 in a stylesheet link to CSS , 不再需要 type 属性, JavaScript 和 CSS 是默认使用的。

  2. html5 中的许多新特性需要使用 javaScript

  3. 使用 JavaScript 能与 DOM 交互 。DOM , Document Object Model

  4. DOM 是网页的内部表示, 使用 JavaScript 你能访问元素,改变元素增加新元素到 DOM

  5. JavaScript API 是一个应用编程接口,API 能够控制html5 的方方面面,例如 2D drawing , video playback 等。

上一篇下一篇

猜你喜欢

热点阅读