The<ul> element creates an unordered list, using tags to identify items; the <li> element represents a single item in the list and contains text content; <ul> is a container element, <li> is List item elements; <ul> does not have a closing tag, <li> has a closing tag.
UL and LI elements in HTML
Question: ul and li in HTML What's the difference?
Answer:
UL element
<ul> <li><ul>
element is used for Create an unordered list.
<li>Items in an unordered list are identified with dots, squares, or other markers.
LI Element
<ul> <li><li>
An element is an item in an unordered list. The
<li>
<li>
element contains the text content in the list.
Difference:
<ul> <li><ul>
element is a container element used to contain <li> ;
element. The
<li>
<li>
element is a list item element that contains a single item in the list. The
<li>
<ul>
element does not have a closing tag, while the <li>
element does.
Example:
<code class="html"><ul> <li>项目 1</li> <li>项目 2</li> <li>项目 3</li> </ul></code>
The above example will generate an unordered list with three items.
The above is the detailed content of How to distinguish between ul and li in html. For more information, please follow other related articles on the PHP Chinese website!