Basic Notes on Modern Web Development·Opening: Starting from the HTML web page skeleton
Modern web pages are no longer a collection of pure text. The three Musketeers each perform their own duties: 🦴 HTML: Define the content structure (skeleton) of the page 🎨 CSS: Control the visual presentation (skin) of the page 🎮 JavaScript: Implement the interactive logic (muscle) of the page
1. First understand: What is HTML?
HTML (HyperText Markup Language) is the only standard markup language for building Web pages - note that it is not a programming language and does not have logical functions such as variables and loops. It is only responsible for using "tags" to "mark" the identity of the content.
For example, use<h1>Tell the browser "This is a first-level title, it needs to be bolded and enlarged", use<p>Mark "This is a normal text".
The latest version is currently HTML5, which is fully supported by all modern browsers (Chrome, Firefox, Safari, Edge latest versions). HTML5 brings practical features such as semantic tags, built-in multimedia support, and form enhancements, completely bidding farewell to the HTML4 era.<div>A confusing situation where structures are stacked and distinguished solely by class names.
2. Your first HTML5 web page: basic document structure
Without further ado, let’s take a look at a complete and directly executable code👇
Copy the above code and save it asindex.html(By default, the browser will open the file namedindexHome page file), double-click to open it, and you will have your first web page!
Let’s explain the core points of this code line by line:
<!DOCTYPE html>: Document type declaration, telling the browser "This is an HTML5 document, please use HTML5 rules to parse it." Must be placed on the first line, otherwise the browser may enter "Quirks Mode", causing the page to display abnormally.<html lang="zh-CN">: The root tag of the HTML document, all content must be placed in it;lang="zh-CN"Indicates that the document language is Simplified Chinese, which is convenient for search engine identification and screen reader reading.<head>: The meta information area of the page, which users cannot see in the browser, but is crucial for page display, SEO, and device adaptation. Common contents include encoding settings, viewport settings, page titles, external resource references, etc.<meta charset="UTF-8">: Character encoding statement, ** must be added! ** Otherwise, Chinese characters and special symbols can easily become garbled characters.<meta name="viewport" content="width=device-width, initial-scale=1.0">: Responsive viewport setting is the first step in mobile terminal adaptation. It tells the browser that "the page width is equal to the device screen width, and the initial scaling ratio is 1.0."<title>: The page title will be displayed on the browser tab and is also very important for SEO (search engine optimization).<body>: The visible content area of the page. All text, pictures, videos, navigation, buttons, etc. that users can see must be placed here.
3. Core features of HTML5 (must learn for beginners)
Compared with the old version, the biggest improvement of HTML5 is semantic and enhanced native capabilities. Below are some of the most commonly used points at the entry level.
3.1 Semantic tags: Use tags to describe content identity
In the era of HTML4, everyone uses common<div>label, and then match it with something likeheader、footerClass name to distinguish. Although the browser can parse the content written in this way, search engines and screen readers cannot understand the structure of the content at all, which results in poor SEO effect and is not conducive to barrier-free access.
HTML5 adds a new set of semantic tags, which can express content directly using tag names:
3.2 Native multimedia support: no more Flash plug-ins
Before HTML5, if you wanted to embed video or audio in a web page, you had to rely on third-party plug-ins such as Flash and Silverlight. These plug-ins have many security vulnerabilities, slow loading, and poor mobile support. They have now been completely eliminated by mainstream browsers.
HTML5 added<video>and<audio>Tag, one line of code can embed multimedia, and also comes with controls for playback, pause, volume adjustment, etc.:
3.3 Form enhancement: Easily reduce JavaScript’s simple validation
HTML5 adds a wealth of native form controls and attributes, which can easily implement functions such as email verification, required verification, and date selection. In the past, you might have to write dozens of lines of JavaScript, but now you can do it in one line of code:
4. Quick understanding: division of labor and collaboration of the Three Musketeers
Although the focus of this article is HTML, modern Web pages cannot be completed with HTML alone. Here is a quick overview of the Separation of Concerns Principle of the Three Musketeers (the core cognition that must be established to get started!):
- 🦴 HTML: only responsible for structure - such as "Here are the first-level headings", "Here are the paragraphs", "Here are the navigation". Don't write styles (style attributes) or behaviors (onclick attributes) directly in HTML.
- 🎨 CSS: only responsible for performance - for example, "The first-level title should be displayed in red, font size 28px, and centered." There are three ways to introduce CSS. It is recommended to use external style sheet (written separately in
.cssfile). - 🎮 JavaScript: only responsible for actions - such as "click the button to display the pop-up window", "slide the slider to update the value synchronously". It is also recommended to use external scripts (written separately in
.jsfile).
5. Recommended HTML introductory learning resources
At the entry level, it is most taboo to read too complicated information. Here are some of the most authoritative and practical ones recommended:
- 📚 MDN Web Docs: The "official bible" of Web technology. The content is jointly maintained by browser manufacturers and Web standards organizations, and the Chinese documentation is also very complete. Address: https://developer.mozilla.org/zh-CN/docs/Web/HTML
- 🎮 freeCodeCamp: A free interactive learning platform, practice while learning, and get a certificate after completing a module. Address: https://www.freecodecamp.org/learn/2022/responsive-web-design/
- 📖 HTML5 Semantic Tag Cheat Sheet: If you encounter a tag that you can’t remember, it’s very convenient to look it up. You can find it by just searching online.
6. Getting Started Summary and Preview
Today we talked about:
- Definition of HTML: Hypertext Markup Language, the skeleton of a Web page.
- Basic document structure of HTML5:
DOCTYPE+html+head+body。 - The three core features of HTML5: semantic tags, native multimedia, and form enhancement.
- The separation of concerns principle of the Three Musketeers.
- Recommended introductory learning resources.
In the next article, we will explain in detail the basic syntax and common selectors of CSS, and give your HTML skeleton a beautiful "skin" ~

