Welcome to the HTML and CSS tutorial! Here, you will learn the basics of HTML and CSS, which are the building blocks of web development.

HTML 简介

HTML (HyperText Markup Language) is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as CSS and JavaScript.

HTML 结构

  • <html>: 根元素,包含整个网页。
  • <head>: 包含元数据,如网页标题、链接、样式等。
  • <body>: 包含网页可见内容。

CSS 简介

CSS (Cascading Style Sheets) is a stylesheet language used to describe the presentation of a document written in HTML or XML.

CSS 选择器

  • id 选择器: 使用 # 符号,例如 #myId
  • class 选择器: 使用 . 符号,例如 .myClass
  • 标签选择器: 直接使用 HTML 标签,例如 p

实例

HTML 示例

<!DOCTYPE html>
<html>
<head>
  <title>My Web Page</title>
</head>
<body>
  <h1>Welcome to My Web Page</h1>
  <p>This is a paragraph.</p>
</body>
</html>

CSS 示例

#myId {
  color: red;
}

.myClass {
  font-size: 20px;
}

p {
  text-align: center;
}

下一步

To continue learning, you can read the HTML Basics and CSS Basics tutorials.


HTML Basics | CSS Basics

HTML
|
CSS