learn2kode.in

CSS Lists

CSS provides properties to control the appearance of HTML lists, including:

1. list-style-type

Defines the type of bullet or numbering for a list

For Unordered Lists (<ul>)

ul {
  list-style-type: square; /* circle, disc, square */
}

Examples:

For Ordered Lists (<ol>)

ol {
  list-style-type: upper-roman; /* decimal, lower-alpha, upper-latin etc. */
}

Examples

2. list-style-image

Use an image instead of a bullet.

ul {
  list-style-image: url('bullet.png');
}

3. list-style-position

Defines where the bullet appears

outside (default) Bullet stays outside the text

ul {
  list-style-position: outside;
}

inside

Bullet is placed inside, and text aligns with it

ul {
  list-style-position: inside;
}

4. Shorthand Property: list-style

You can combine all three in one:

ul {
  list-style: square inside url('icon.png');
}

Order doesn’t matter.

5. Removing Bullets Completely

Useful for navigation menus:

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

Example: Styled List

<ul class="custom-list">
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>
.custom-list {
  list-style-type: square;
  list-style-position: inside;
  color: #444;
  font-size: 18px;
}

Output Summary

CSS List Properties:

Property Description
list-style-type Bullet or numbering style
list-style-image Custom image bullet
list-style-position Bullet inside/outside
list-style Shorthand for all list properties