整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

HTML列表及实例

HTML列表及实例

TML 支持有序、无序和定义列表

实例

无序列表

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h4>一个无序列表:</h4>

<ul>

<li>咖啡</li>

<li>茶</li>

<li>牛奶</li>

</ul>

</body>

</html>

[/demo]

本例演示无序列表。

有序列表

[demo]

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<ol>

<li>咖啡</li>

<li>牛奶</li>

<li>茶</li>

</ol>

<ol start="50">

<li>咖啡</li>

<li>牛奶</li>

<li>茶</li>

</ol>

</body>

</html>

[/demo]

本例演示有序列表。

无序列表

无序列表是一个项目的列表,此列项目使用粗体圆点(典型的小黑圆圈)进行标记。

无序列表始于 <ul> 标签。每个列表项始于 <li>。

<ul>

<li>Coffee</li>

<li>Milk</li>

</ul>

浏览器显示如下:

Coffee

Milk

列表项内部可以使用段落、换行符、图片、链接以及其他列表等等。

有序列表

同样,有序列表也是一列项目,列表项目使用数字进行标记。

有序列表始于 <ol> 标签。每个列表项始于 <li> 标签。

<ol>

<li>Coffee</li>

<li>Milk</li>

</ol>

浏览器显示如下:

Coffee

Milk

列表项内部可以使用段落、换行符、图片、链接以及其他列表等等。

定义列表

自定义列表不仅仅是一列项目,而是项目及其注释的组合。

自定义列表以 <dl> 标签开始。每个自定义列表项以 <dt> 开始。每个自定义列表项的定义以 <dd> 开始。

<dl>

<dt>Coffee</dt>

<dd>Black hot drink</dd>

<dt>Milk</dt>

<dd>White cold drink</dd>

</dl>

浏览器显示如下:

Coffee

Black hot drink

Milk

White cold drink

定义列表的列表项内部可以使用段落、换行符、图片、链接以及其他列表等等。

更多实例

不同类型的无序列表

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h4>Disc 项目符号列表:</h4>

<ul type="disc">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ul>

<h4>Circle 项目符号列表:</h4>

<ul type="circle">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ul>

<h4>Square 项目符号列表:</h4>

<ul type="square">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ul>

</body>

</html>

[/demo]

本例演示一个无序列表。

不同类型的有序列表

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h4>数字列表:</h4>

<ol>

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ol>

<h4>字母列表:</h4>

<ol type="A">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ol>

<h4>小写字母列表:</h4>

<ol type="a">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ol>

<h4>罗马字母列表:</h4>

<ol type="I">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ol>

<h4>小写罗马字母列表:</h4>

<ol type="i">

<li>苹果</li>

<li>香蕉</li>

<li>柠檬</li>

<li>桔子</li>

</ol>

</body>

</html>

[/demo]

本例演示不同类型的有序列表。

嵌套列表

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h4>一个嵌套列表:</h4>

<ul>

<li>咖啡</li>

<li>茶

<ul>

<li>红茶</li>

<li>绿茶</li>

</ul>

</li>

<li>牛奶</li>

</ul>

</body>

</html>

[/demo]

本例演示如何嵌套列表。

嵌套列表 2

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h4>一个嵌套列表:</h4>

<ul>

<li>咖啡</li>

<li>茶

<ul>

<li>红茶</li>

<li>绿茶

<ul>

<li>中国茶</li>

<li>非洲茶</li>

</ul>

</li>

</ul>

</li>

<li>牛奶</li>

</ul>

</body>

</html>

[/demo]

本例演示更复杂的嵌套列表。

定义列表

[demo]

<html>

<head>

<meta charset="UTF-8">

</head>

<body>

<h2>一个定义列表:</h2>

<dl>

<dt>计算机</dt>

<dd>用来计算的仪器 ... ...</dd>

<dt>显示器</dt>

<dd>以视觉方式显示信息的装置 ... ...</dd>

</dl>

</body>

</html>

[/demo]

本例演示一个定义列表。

列表标签

标签 描述

<ol> 定义有序列表。

<ul> 定义无序列表。

<li> 定义列表项。

<dl> 定义定义列表。

<dt> 定义定义项目。

<dd> 定义定义的描述。

<dir> 已废弃。使用 <ul> 代替它。

<menu> 已废弃。使用 <ul> 代替它。

欢迎使用 Markdown在线编辑器 MdEditor

**Markdown是一种轻量级的「标记语言」**

![markdown](https://www.mdeditor.com/images/logos/markdown.png "markdown")

Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式。它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面,Markdown文件的后缀名便是“.md”

## MdEditor是一个在线编辑Markdown文档的编辑器

*MdEditor扩展了Markdown的功能(如表格、脚注、内嵌HTML等等),以使让Markdown转换成更多的格式,和更丰富的展示效果,这些功能原初的Markdown尚不具备。*

> Markdown增强版中比较有名的有Markdown Extra、MultiMarkdown、 Maruku等。这些衍生版本要么基于工具,如~~Pandoc~~,Pandao;要么基于网站,如GitHub和Wikipedia,在语法上基本兼容,但在一些语法和渲染效果上有改动。

MdEditor源于Pandao的JavaScript开源项目,开源地址[Editor.md](https://github.com/pandao/editor.md "Editor.md"),并在MIT开源协议的许可范围内进行了优化,以适应广大用户群体的需求。向优秀的markdown开源编辑器原作者Pandao致敬。

![Pandao editor.md](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png "Pandao editor.md")

## MdEditor的功能列表演示

# 标题H1

## 标题H2

### 标题H3

#### 标题H4

##### 标题H5

###### 标题H5

### 字符效果和横线等

----

~~删除线~~ <s>删除线(开启识别HTML标签时)</s>

*斜体字* _斜体字_

**粗体** __粗体__

***粗斜体*** ___粗斜体___

上标:X<sub>2</sub>,下标:O<sup>2</sup>

**缩写(同HTML的abbr标签)**

> 即更长的单词或短语的缩写形式,前提是开启识别HTML标签时,已默认开启

The <abbr title="Hyper Text Markup Language">HTML</abbr> specification is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.

### 引用 Blockquotes

> 引用文本 Blockquotes

引用的行内混合 Blockquotes

> 引用:如果想要插入空白换行`即<br />标签`,在插入处先键入两个以上的空格然后回车即可,[普通链接](https://www.mdeditor.com/)。

### 锚点与链接 Links

[普通链接](https://www.mdeditor.com/)

[普通链接带标题](https://www.mdeditor.com/ "普通链接带标题")

直接链接:<https://www.mdeditor.com>

[锚点链接][anchor-id]

[anchor-id]: https://www.mdeditor.com/

[mailto:test.test@gmail.com](mailto:test.test@gmail.com)

GFM a-tail link @pandao

邮箱地址自动链接 test.test@gmail.com www@vip.qq.com

> @pandao

### 多语言代码高亮 Codes

#### 行内代码 Inline code

执行命令:`npm install marked`

#### 缩进风格

即缩进四个空格,也做为实现类似 `<pre>` 预格式化文本 ( Preformatted Text ) 的功能。

<?php

echo "Hello world!";

?>

预格式化文本:

| First Header | Second Header |

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

| Content Cell | Content Cell |

| Content Cell | Content Cell |

#### JS代码

```javascript

function test() {

console.log("Hello world!");

}

```

#### HTML 代码 HTML codes

```html

<!DOCTYPE html>

<html>

<head>

<mate charest="utf-8" />

<meta name="keywords" content="Editor.md, Markdown, Editor" />

<title>Hello world!</title>

<style type="text/css">

body{font-size:14px;color:#444;font-family: "Microsoft Yahei", Tahoma, "Hiragino Sans GB", Arial;background:#fff;}

ul{list-style: none;}

img{border:none;vertical-align: middle;}

</style>

</head>

<body>

<h1 class="text-xxl">Hello world!</h1>

<p class="text-green">Plain text</p>

</body>

</html>

```

### 图片 Images

图片加链接 (Image + Link):

[![](https://www.mdeditor.com/images/logos/markdown.png)](https://www.mdeditor.com/images/logos/markdown.png "markdown")

> Follow your heart.

----

### 列表 Lists

#### 无序列表(减号)Unordered Lists (-)

- 列表一

- 列表二

- 列表三

#### 无序列表(星号)Unordered Lists (*)

* 列表一

* 列表二

* 列表三

#### 无序列表(加号和嵌套)Unordered Lists (+)

+ 列表一

+ 列表二

+ 列表二-1

+ 列表二-2

+ 列表二-3

+ 列表三

* 列表一

* 列表二

* 列表三

#### 有序列表 Ordered Lists (-)

1. 第一行

2. 第二行

3. 第三行

#### GFM task list

- [x] GFM task list 1

- [x] GFM task list 2

- [ ] GFM task list 3

- [ ] GFM task list 3-1

- [ ] GFM task list 3-2

- [ ] GFM task list 3-3

- [ ] GFM task list 4

- [ ] GFM task list 4-1

- [ ] GFM task list 4-2

----

### 绘制表格 Tables

| 项目 | 价格 | 数量 |

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

| 计算机 | 00 | 5 |

| 手机 | | 12 |

| 管线 | | 234 |

First Header | Second Header

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

Content Cell | Content Cell

Content Cell | Content Cell

| First Header | Second Header |

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

| Content Cell | Content Cell |

| Content Cell | Content Cell |

| Function name | Description |

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

| `help()` | Display the help window. |

| `destroy()` | **Destroy your computer!** |

| Left-Aligned | Center Aligned | Right Aligned |

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

| col 3 is | some wordy text | 00 |

| col 2 is | centered | |

| zebra stripes | are neat | |

| Item | Value |

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

| Computer | 00 |

| Phone | |

| Pipe | |

----

#### 特殊符号 HTML Entities Codes

? & ¨ ? ? £

& < > ¥  ? ± ? § | ˉ ? ·

X2 Y3 ? ? × ÷ ?

18oC " '

[========]

### Emoji表情 :smiley:

> Blockquotes :star:

#### GFM task lists & Emoji & fontAwesome icon emoji & editormd logo emoji :editormd-logo-5x:

- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;

- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;

- [x] [ ] :smiley: this is a complete item :smiley:;

- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;

- [ ] [ ]this is an incomplete item :fa-star: :fa-gear:;

- [ ] :smiley: this is an incomplete item [test link](#) :fa-star: :fa-gear:;

- [ ] :smiley: this is :fa-star: :fa-gear: an incomplete item [test link](#);

#### 反斜杠 Escape

\*literal asterisks\*

[========]

### 科学公式 TeX(KaTeX)

$$E=mc^2$$

行内的公式$$E=mc^2$$行内的公式,行内的$$E=mc^2$$公式。

$$x > y$$

$$\(\sqrt{3x-1}+(1+x)^2\)$$

$$\sin(\alpha)^{\theta}=\sum_{i=0}^{n}(x^i + \cos(f))$$

多行公式:

```math

\displaystyle

\left( \sum\_{k=1}^n a\_k b\_k \right)^2

\leq

\left( \sum\_{k=1}^n a\_k^2 \right)

\left( \sum\_{k=1}^n b\_k^2 \right)

```

```katex

\displaystyle

\frac{1}{

\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{

\frac25 \pi}}=1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {

1+\frac{e^{-6\pi}}

{1+\frac{e^{-8\pi}}

{1+\cdots} }

}

}

```

```latex

f(x)=\int_{-\infty}^\infty

\hat f(\xi)\,e^{2 \pi i \xi x}

\,d\xi

```

### 分页符 Page break

> Print Test: Ctrl + P

[========]

### 绘制流程图 Flowchart

```flow

st=>start: 用户登陆

op=>operation: 登陆操作

cond=>condition: 登陆成功 Yes or No?

e=>end: 进入后台

st->op->cond

cond(yes)->e

cond(no)->op

```

[========]

### 绘制序列图 Sequence Diagram

```seq

Andrew->China: Says Hello

Note right of China: China thinks\nabout it

China-->Andrew: How are you?

Andrew->>China: I am good thanks!

```

### 开源项目(vue-admin)

项目地址 https://github.com/artdong/vue-admin

演示动态图

![动态图](https://github.com/artdong/vue-admin/blob/develop/assets/screenshot/vue2-admin-grace-v1.1.gif?raw=true)

### 开源项目(ionic3-awesome)

项目地址 https://github.com/artdong/ionic3-awesome

演示动态图

![ionic3-awesome.gif](https://upload-images.jianshu.io/upload_images/3100736-93d6f0f06bec9cff.gif?imageMogr2/auto-orient/strip)

##联系方式

* 邮件(hanshangyan@qq.com, 把#换成@)

* QQ: 1029278668

* github: [@artdong](https://github.com/artdong)

* : [@全栈弄潮儿](https://www.toutiao.com/c/user/56196722948/#mid=1559994731399169)

* 简书: [@全栈弄潮儿](https://www.jianshu.com/u/6c16640d68d2)

* 知乎: [@全栈弄潮儿](https://www.zhihu.com/people/alex-008/activities)

* 博客园: [@全栈弄潮儿](http://www.cnblogs.com/LVBingo)

* 掘金:[@全栈弄潮儿](https://juejin.im/user/5b5059f0e51d4519490924ef)

---

经典前端面试题每日更新,欢迎参与讨论,地址:https://github.com/daily-interview/fe-interview。

---

更多angular1/2/4/5、ionic1/2/3、react、vue、微信小程序、nodejs等技术文章、视频教程和开源项目,请关注微信公众号——全栈弄潮儿。

### End

lt;font></font>标记和CSS替代语法

文本的大小 文本的颜色 文本的字体

size(1-7,默认值为3) color face

font-size color font-family

<font size=3 color="red" face="楷体">font标签的属性用法</font>
<p style="font-size:20px;color:red;font-family:楷体">文本的CSS用法</p>

<b>标记

font-weight:bold;

<i>标记

font-style:italic;

<u>标记

text-decoration:underline;

实例:

<font color="red" size="3"><b><i>欢迎光临我的网站</i></b></font>
<style type="text/css">
.txt1{color:red;background:white;font-style:italic;font-weight:bold;}
</style>
<font class="txt1">使用CSS</font>
<sup></sup> 文字上标字体标签(super)
<sub></sub> 文字下标字体标签(subscipt)
.txt_super{
vertical-align: super;
}
.txt_sub{
vertical-align: sub;
}


<hr/>标记

水平线的高度 对齐方式 宽度 颜色 边框颜色

size align width color

height text-align width background-color border-color

<hr size=50 align="center" width=100 color="red"/>
<hr style="height:50px;align:center;width:100px";background-color="red"/>

<ul>标记

type属性值

disc 默认值,实心圆。

circle 空心圆。

square 实心方块。

list-style-type:

disc(实心圆)、circle(空心圆)、square(方块)、decimal(阿拉伯数字)、lower-roman(小写罗马数字)、

upper-roman(大写罗马数字)、lower-alpha(小写英文字母)、upper-alpha(大写英文字母)、none(无项目符号)。

默认值:disc(实心圆)


<ol>标记

type属性值

1 默认值。数字有序列表。(1、2、3、4)

a 按字母顺序排列的有序列表,小写。(a、b、c、d)

A 按字母顺序排列的有序列表,大写。(A、B、C、D)

i 罗马字母,小写。(i, ii, iii, iv)

I 罗马字母,大写。(I, II, III, IV)

list-style-type:

disc(实心圆)、circle(空心圆)、square(方块)、decimal(阿拉伯数字)、lower-roman(小写罗马数字)、

upper-roman(大写罗马数字)、lower-alpha(小写英文字母)、upper-alpha(大写英文字母)、none(无项目符号)。

默认值:disc(实心圆)


<table>表格

实例:合并图片

利用HTML4提供cellpadding和cellspacing属性,可以达到合并图片的效果,但是HTML5已经确定不再支持这两个属性

<table cellpadding="0" cellspacing="0">
<tr>
<td><img src="ch07_03/1.jpg"/></td>
<td><img src="ch07_03/2.jpg"/></td>
</tr>
<tr>
<td><img src="ch07_03/3.jpg"/></td>
<td><img src="ch07_03/4.jpg"/></td>
</tr>
</table>

使用CSS样式实现合并图片

<!DOCTYPE HTML>
<html>
<head>
<title>合并图片</title>
<style type="text/css">
table{border-collapse: collapse;} /* 边框会合并为一个单一的边框 */
td{padding:0;}
img{display: block;}
</style>
</head>
<body>
<table>
<tr>
<td><img src="ch07_03/1.jpg"/></td>
<td><img src="ch07_03/2.jpg"/></td>
</tr>
<tr>
<td><img src="ch07_03/3.jpg"/></td>
<td><img src="ch07_03/4.jpg"/></td>
</tr>
</table>
</body>
</html>

使用CSS语法进行定位