WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML Lists

.

Example of an unordered rundown and an arranged rundown in HTML:

Unordered List:

  • Part
  • Part
  • Part
  • Part

Ordered List:

  1. First Part
  2. Second Part
  3. Third Part
  4. Fourth Part


Unordered HTML Lists

An unordered rundown begins with the <ul> tag. Each rundown thing begins with the <li> tag.

Example

<ul>
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ul>

Try it Yourself »


.

Unordered HTML Lists - The Style Attribute

A style ascribe can be added to a unordered list, to characterize the style of the marker:

Style Description
list-style-type:disc The list part will be set apart with bullets
list-style-type:circle The list part will be set apart with circles
list-style-type:square The list part will be set apart with squares
list-style-type:none The list part won't be marked

Disc:

<ul style="list-style-type:disc">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ul>
Try it Yourself »

Circle:

<ul style="list-style-type:circle">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ul>
Try it Yourself »

Square:

<ul style="list-style-type:square">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ul>
Try it Yourself »

None:

<ul style="list-style-type:none">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ul>
Try it Yourself »

Ordered HTML Lists

An requested rundown begins with the <ol> tag. Each rundown thing begins with the <li> tag.

The list things will be set apart with numbers:

Example

<ol>
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

.

Ordered HTML Lists - The Type Attribute

A type credit can be added to a ordered list, to characterize the kind of the marker:

Type Description
type="1" The list things will be numbered with numbers (default)
type="A" The list things will be numbered with capitalized letters
type="a" The list things will be numbered with lowercase letters
type="I" The list things will be numbered with capitalized roman numbers
type="i" The list things will be numbered with lowercase roman numbers

Numbers:

<ol type="1">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

Uppercase Letters:

<ol type="A">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

Lowercase Letters:

<ol type="a">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

Uppercase Roman Numbers:

<ol type="I">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

Lowercase Roman Numbers:

<ol type="i">
  <li>apple</li>
  <li>banana</li>
  <li> pineapples</li>
</ol>
Try it Yourself »

HTML Description Lists

HTML likewise underpins depiction lists.

A portrayal list is a rundown of terms, with a depiction of each term.

The <dl> tag characterizes the portrayal list, the <dt> tag characterizes the term (name), and the <dd> tag depicts each term: 

Example

<dl>
  <dt>apple</dt>
  <dd>- red apple</dd>
  <dt> pineapples</dt>
  <dd>- green pineapple</dd>
</dl>
Try it Yourself »

.

Nested HTML Lists

List can be settled (records inside lists):

Example

<ul>
  <li>apple</li>
  <li>banana
    <ul>
      <li>yellow banana</li>
      <li>Green banana</li>
    </ul>
  </li>
  <li> pineapples</li>
</ul>
Try it Yourself »

Horizontal Lists

HTML records can be styled from multiple points of view with CSS.

One mainstream way, is to style a rundown to be shown horizontally:

Example

<!DOCTYPE html>
<html>

<head>
<style>
ul#menu li {
    display:inline;
}
</style>
</head>

<body>

<h2>Horizontal List</h2>

<ul id="menu">
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
  <li>PHP</li>
</ul>

</body>
</html>
Try it Yourself »

With some additional style, you can make it resemble a menu:

Example

ul#menu {
    cushioning: 0;
}

ul#menu li {
    show: inline;
}

ul#menu li a {
    foundation shading: black;
    shading: white;
    cushioning: 10px 20px;
    content adornment: none;
    outskirt range: 4px 0 0;
}

ul#menu li a:hover {
    foundation shading: orange;
}
Try it Yourself »

Chapter Summary

  • Use the HTML <ul> component to characterize an unordered list
  • Use the HTML style credit to characterize the shot style
  • Use the HTML <ol> component to characterize an arranged list
  • Use the HTML type ascribe to characterize the numbering type
  • Use the HTML <li> component to characterize a rundown item
  • Use the HTML <dl> component to characterize a depiction list
  • Use the HTML <dt> component to characterize the depiction term
  • Use the HTML <dd> component to characterize the depiction information
  • Lists can be settled inside lists
  • List things can contain other HTML components
  • Use the CSS property display:inline to show a rundown horizontally