什么是 Web?
理解什么世界 Wide Web 是, 如何它 differs 从 internet, and 如何 pages 是 delivered.
你将学到
- 什么世界 Wide Web 是, in plain terms
- difference 之间 web and internet
- 客户端–服务器 model 那个 powers 每个 website
- three languages 每个 web page uses: HTML, CSS, JavaScript
概念讲解
What Is the Web?
The World Wide Web (or just " web") is a system of documents — web pages — connected by links, viewed in a browser. When you open a website, your browser fetches pages from servers around the world and displays them on your screen.
The Web vs. The Internet
People use these terms interchangeably, but they are different:
- The internet is the physical network — the cables, routers, and protocols that move data between computers.
- The web is a service that runs *on top of* the internet. Email, video calls, and file transfers also use the internet but are not " web."
The internet is the road; the web is one of the vehicles driving on it.
The Client–Server Model
每个web interaction involves two roles:
- Client — your browser. It *requests* pages.
- Server — a remote computer. It *responds* with the page content.
You type a URL (request) → the server finds the file → it sends the HTML back (response) → your browser renders it. This request–response cycle is the heartbeat of the web.
The Three Languages
每个web page is built from three languages working together:
- HTML — structure and content (the skeleton).
- CSS — appearance and layout (the skin).
- JavaScript — behavior and interactivity (the muscles).
You do not need all three for every page, but any modern site uses them together. The rest of this topic explores each in turn, plus the protocols (HTTP, URLs) and data formats (JSON) that tie them together.
示例代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My First Page</title>
<style>
h1 { color: #2563eb; } /* CSS: appearance */
</style>
</head>
<body>
<h1>Hello, Web!</h1> <!-- HTML: structure -->
<button onclick="alert('Hi!')">Click me</button> <!-- JS: behavior -->
</body>
</html>
完整 web page in one file. HTML provides 结构, CSS 样式, and JavaScript (通过 onclick) interactivity. In 真实项目这些是 通常 separated 到 .HTML, .CSS, and .js files.
动手试一试
- HTML ↔ Markdown
Convert 之间 HTML and Markdown — see 如何 structured 内容映射到 web markup.
常见错误
错误写法
Thinking web and internet 是相同 thing.
正确做法
internet 是 underlying network; web 是 one service 运行 on 它. Email and streaming 也 use internet 但是 不 ' web'.
错误写法
Believing website lives 'in 你的浏览器'.
正确做法
site lives on 服务器. 你的浏览器获取复制 and 渲染它. Refreshing re-获取 latest version 从服务器.
相关资源
相关速查表
- HTML Cheatsheet
快速引用 for 所有常见 HTML 标签.
- CSS Cheatsheet
引用 for 样式属性 used in web pages.
练习 什么是 Web?
1 个练习
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。