Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Markdown Tables

Markdown Tables

Tables and blockquotes are important content-organization tools in Markdown.

Tables clearly present structured data, while blockquotes are used to highlight important information or cite others' opinions.

Markdown creates tables using | to separate cells and - to separate the header row from the other rows.

The syntax format is as follows:

|  表头   | 表头  |

|  ----  | ----  |

| 单元格  | 单元格 |

| 单元格  | 单元格 |

The result of the above code is shown below:

Syntax key points:

Alignment

We can set the alignment of a table:

The example is as follows:

| 左对齐 | 右对齐 | 居中对齐 |

| :-----| ----: | :----: |

| 单元格 | 单元格 | 单元格 |

| 单元格 | 单元格 | 单元格 |

The result of the above code is shown below:

Tips for handling complex tables

Cell content formatting

Most Markdown syntax can be used inside table cells:

| 功能 | 描述 | 状态 |

|------|------|:----:|

| **用户登录** | 支持邮箱和手机号登录 | ✅ |

| *密码重置* | 通过邮箱重置密码 | ⚠️ |

| `API接口` | RESTful API 设计 | ✅ |

| [文档链接](https://example.com) | 查看详细文档 | 📖 |

Handling long text

When cell content is long, you can use the following techniques:

Line break handling:

| 项目 | 详细说明 |

|------|----------|

| 需求分析 | 1. 收集用户需求
2. 分析业务场景
3. 确定功能范围 | | 技术选型 | 前端:React + TypeScript
后端:Node.js + Express
数据库:MongoDB |

** Abbreviations and links:**

| 技术栈 | 说明 | 官网 |

|--------|------|------|

| React | 用户界面库 | [链接](https://reactjs.org) |

| Vue.js | 渐进式框架 | [链接](https://vuejs.org) |

| Angular | 完整的框架 | [链接](https://angular.io) |

Special characters in tables

Some characters have special meanings in tables and need to be escaped:

| 字符 | 转义方法 | 示例 |

|------|----------|------|

| 竖线 | `\|` | 显示 \| 符号 |

| 反斜杠 | `\\` | 显示 \\ 符号 |

| HTML | 直接使用 | 
|

Table beautification suggestions

Use Emoji and symbols

| 状态 | 图标 | 说明 |

|:----:|:----:|------|

| 完成 | ✅ | 任务已完成 |

| 进行中 | 🔄 | 正在处理 |

| 待处理 | ⏳ | 等待开始 |

| 错误 | ❌ | 出现问题 |

| 警告 | ⚠️ | 需要注意 |

Best practices for data tables

Financial data tables:

| 月份 | 收入 | 支出 | 利润 | 增长率 |

|:----:|-----:|-----:|-----:|-------:|

| 1月 | ¥50,000 | ¥35,000 | ¥15,000 | - |

| 2月 | ¥55,000 | ¥38,000 | ¥17,000 | +13.3% |

| 3月 | ¥62,000 | ¥42,000 | ¥20,000 | +17.6% |

| **总计** | **¥167,000** | **¥115,000** | **¥52,000** | **+31.1%** |

Technical comparison tables:

| 特性 | React | Vue.js | Angular | 评分 |

|------|:-----:|:------:|:-------:|:----:|

| 学习曲线 | 中等 | 简单 | 复杂 | Vue ⭐⭐⭐ |

| 性能表现 | 优秀 | 优秀 | 良好 | 平分 ⭐⭐⭐ |

| 生态系统 | 丰富 | 成长中 | 完整 | React ⭐⭐⭐ |

| 企业支持 | Facebook | 社区 | Google | Angular ⭐⭐⭐ |

Responsive table handling

For complex tables, consider breaking them into multiple simple tables.

Mobile-friendly design:

### 基本信息

| 项目 | 值 |

|------|-----|

| 姓名 | 张三 |

| 年龄 | 25 |

| 职业 | 工程师 |



### 联系方式

| 类型 | 信息 |

|------|------|

| 邮箱 | zhang@example.com |

| 电话 | 138-0013-8000 |

| 地址 | 北京市朝阳区 |