<ul>


HTML <ul> Tag

Instance

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head> 
<body>

<h4>无序列表:</h4>
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

</body>
</html>

Run Example»

Click the "Run Instance" button to view the online instance


Browser support

1000.png

All major browsers support< ul> tag.


Tag definition and usage instructions

<ul> Tag definition unordered list.

Use the <ul> tag together with the <li> tag to create an unordered list.


Tips and Notes

Tips: Use CSS to style the list.

Tip: Use the <ol> tag to create an ordered list.


Differences between HTML 4.01 and HTML5

In HTML 4.01, the "compact" and "type" attributes are deprecated. HTML5 does not support these two attributes.


Properties

PropertiesValueDescription
compactcompactHTML5 is not supported. HTML 4.01 is deprecated. Specifies that the list should be rendered smaller than normal.
typedisc
square
circle
HTML5 is not supported. HTML 4.01 is deprecated. Specifies the type of bullets for the list.


Global attributes

<ul> tag supports global attributes of HTML.


Event attributes

<ul> tag supports HTML event attributes.

Try it - Example

Nested List
This example demonstrates how to nest lists.

Instance

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>

<h4>嵌套列表:</h4>
<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea</li>
    </ul>
  </li>
  <li>Milk</li>
</ul>

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance

Nested List 2
This example demonstrates a more complex nested list.

Instance

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>

<h4>嵌套列表:</h4>
<ul>
  <li>Coffee</li>
  <li>Tea
    <ul>
      <li>Black tea</li>
      <li>Green tea
        <ul>
          <li>China</li>
          <li>Africa</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Milk</li>
</ul>

</body>
</html>

Run instance»

Click the "Run instance" button to view the online instance


Related Articles

HTML Tutorial: HTML List