- HTML 教程
- HTML 5简介
- HTML 5 视频
- HTML 5 音频
- HTML 5 Canvas
- HTML 5 Web 存储
- HTML 5 Input 类型
- HTML 5 表单元素
- HTML 5 表单属性
- HTML 5 参考手册
- HTML 5 标准事件属性
- <!-->
- <!DOCTYPE>
- <abbr>
- <acronym>
- <address>
- <applet>
- <area>
- <article>
- <aside>
- <audio>
- <b>
- <base>
- <basefont>
- <bdo>
- <blockquote>
- <body>
- <br />
- <button>
- <canvas>
- <caption>
- <center>
- <em> <strong> <dfn> <code> <samp> <kbd> <var> <cite> 标签
- <col>
- <colgroup>
- <command>
- <datalist>
- <dd>
- <del>
- <details>
- <dir>
- <div>
- <dl>
- <dt>
- <embed>
- <fieldset>
- <figcaption>
- <figure>
- <font>
- <footer>
- <form>
- <frame>
- <frameset>
- <h1> 至 <h6>
- <head>
- <header>
- <hgroup>
- <hr>
- <html>
- <i>
- <iframe>
- <img>
- <input>
- <ins>
- <keygen>
- <em> <strong> <dfn> <code> <samp> <kbd> <var> <cite>
- <label>
- <legend>
- <li>
- <link>
- <map>
- <mark>
- <menu>
- <meta>
- <meter>
- <nav>
- <noframes>
- <object>
- <ol>
- <optgroup>
- <option>
- <output>
- <p>
- <param>
- <pre>
- <progress>
- <q>
- <rp>
- <rt>
- <ruby>
- <s>
- <script>
- <section>
- <select>
- <small>
- <source>
- <span>
- <strike>
- <style>
- <sub> 和 <sup>
- <summary>
- <table>
- <tbody>
- <td>
- <textarea>
- <tfoot>
- <th>
- <thead>
- <time>
- <title>
- <tr>
- <tt>
- <u>
- <ul>
- <video>
定义和用法
<li> 标签定义列表项,有序列表和无序列表中都使用 <li> 标签。
HTML 4.01 与 HTML 5 之间的差异
在 HTML 4.01 中, 不赞成使用 "type" 和 "value" 属性。
在 HTML 5 中,不再支持 "type" 属性。
在 HTML 5 中, 并没有不赞成使用 "value" 属性,但是仅能够与 <ol> 元素一起使用。
提示和注释
提示:请使用 CSS 来定义列表的类型。
例子
<ol> <li>Coffee</li> <li>Tea</li> </ol> <ol> <li value="8">Coffee</li> <li>Tea</li> </ol> <ul> <li>Coffee</li> <li>Tea</li> </ul>
属性
属性 | 值 | 描述 | DTD |
type | A a I i 1 disc square circle | 规定列表的类型。不赞成使用。请使用样式替代。 | TF |
value | number_of_list_item | TF |
标准属性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark,
tabindex, template, title
如需完整的描述,请访问 HTML 5 中标准属性。
事件属性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend,
ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress,
onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup,
onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,请访问 HTML 5 中事件属性。
实例.
无序列表
<html> <body> <h4>一个无序列表:</h4> <ul> <li>咖啡</li> <li>茶</li> <li>牛奶</li> </ul> </body> </html>
上例演示一个无序列表。
有序列表
<html> <body> <h4>一个有序列表:</h4> <ol> <li>咖啡</li> <li>茶</li> <li>牛奶</li> </ol> </body> </html>
上例演示一个有序列表。
嵌套列表
<html> <body> <h4>一个嵌套列表:</h4> <ul> <li>咖啡</li> <li>茶 <ul> <li>红茶</li> <li>绿茶</li> </ul> </li> <li>牛奶</li> </ul> </body> </html>
上例演示如何嵌套列表。
嵌套列表 2,
<html> <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>
上例演示更复杂的嵌套列表。