Ensiklopedia VibeKoding: Fundamentals of HTML/CSS Layout.Ensiklopedia VibeKoding: Fundamentals of HTML/CSS Layout.
How are web pages made? Why do some pages only have text, while others are as interactive as applications? This question leads to the three cornerstones of web development, helping you understand the structure behind every web page.How are web pages made? Why do some pages only have text, while others are as interactive as applications? This question leads to the three cornerstones of web development, helping you understand the structure behind every web page.
------
Imagine a poster you see on the street. You can only look at it, not interact with it โ the poster won't change its content just because you looked at it, nor will it pop up more information because you tapped somewhere.Imagine a poster you see on the street. You can only look at it, not interact with it โ the poster won't change its content just because you looked at it, nor will it pop up more information because you tapped somewhere.
Early web pages were exactly like these "electronic posters": view-only, immutable, with fixed content.Early web pages were exactly like these "electronic posters": view-only, immutable, with fixed content.
But modern web pages are completely different. They behave like desktop applications:But modern web pages are completely different. They behave like desktop applications:
The core reason for this transformation is the three cornerstones of web technology: HTML + CSS + JavaScript.The core reason for this transformation is the three cornerstones of web technology: HTML + CSS + JavaScript.
| Technology | ๐ House Analogy | Actual Role | Concrete Example |
|---|---|---|---|
| HTML | The house's structure and materials | Defines the content and hierarchy of the page | This is a wall, this is a window, this is a room |
| CSS | The house's decoration and appearance | Controls the style and layout of the page | Paint the wall blue, place the window on the east side, tile the floor |
| JavaScript | The house's appliances and smart systems | Enables interactivity and logic on the page | Press the switch and the light turns on, open the door and the curtains automatically draw |
HTML โ CSS: You need a house first before you can decorate it. HTML is the foundation, CSS is the beautification. HTML + CSS โ JavaScript: You need the house and decoration before you can install smart systems. JavaScript makes a "dead" page come "alive." Core Idea: Each of the three has its own role, and none is dispensable. A page with only HTML is ugly, a page with only HTML+CSS can't be interactive, and only with all three can you build "web applications" like WeChat Web or Taobao.HTML โ CSS: You need a house first before you can decorate it. HTML is the foundation, CSS is the beautification. HTML + CSS โ JavaScript: You need the house and decoration before you can install smart systems. JavaScript makes a "dead" page come "alive." Core Idea: Each of the three has its own role, and none is dispensable. A page with only HTML is ugly, a page with only HTML+CSS can't be interactive, and only with all three can you build "web applications" like WeChat Web or Taobao.
๐ The demo below shows how HTML/CSS/JavaScript work together:๐ The demo below shows how HTML/CSS/JavaScript work together:
------
Before HTML existed, content on the internet was just plain text. Like the text you're reading right now โ no formatting, no hierarchy, no links.Before HTML existed, content on the internet was just plain text. Like the text you're reading right now โ no formatting, no hierarchy, no links.
What's wrong with plain text?What's wrong with plain text?
HTML (HyperText Markup Language) was created to solve these problems. It uses "tags" to mark the meaning of content, telling the browser "what this is."HTML (HyperText Markup Language) was created to solve these problems. It uses "tags" to mark the meaning of content, telling the browser "what this is."
The basic unit of HTML is the "tag." Tags are wrapped in angle brackets < > and come in pairs:The basic unit of HTML is the "tag." Tags are wrapped in angle brackets < > and come in pairs:
html <h1>This is a heading</h1> <p>This is a paragraph</p> <a href="url">This is a link</a>
Key Concepts:Key Concepts:
| Concept | Explanation | Example |
|---|---|---|
| Tag | A marker wrapped in angle brackets | , |
| Element | The tag + its content as a whole | |
| Attribute | Additional information on a tag | href="#", class="card" |
| Nesting | Tags placed inside other tags | |
Many beginners get dizzy seeing a bunch of Description text. Actually, reading HTML code follows a fixed pattern: Step 1: Find the "outermost layer" ``html `Title
Step 2: Guess the meaning from the tag name | Tag Name | Quick Memory | What Goes Inside | |----------|-------------|-------------------| | | Big box | Any content, used for grouping | | | Small box | Text fragments, used for marking | | | Paragraph | A block of text | | - | Heading | Heading text, smaller number = more important | | | Anchor/Link | Clickable content that navigates | | | Image | No content inside, uses src to point to an image | |