How to style unordered lists with CSS

The code below shows you how to style unordered lists with CSS.

Note: the list-style-type property is applied to either <ul> or <li> elements and is used to change the style of the list item marker.

Unordered lists, lists made with the <ul> element, can have a possibility of four different styles: disc, circle, square and none.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Web Development Tutorials.com</title>

<style type="text/css">
ul.disc { list-style-type: disc; }
ul.circle { list-style-type: circle; }
ul.square { list-style-type: square; }
ul.none { list-style-type: none; }
</style>

</head>
<body>
<ul class="disc">
<li>this list has a disc style list marker</li>
<li>this list has a disc style list marker</li>
</ul>

<ul class="circle">
<li>this list has a circle style list marker</li>
<li>this list has a circle style list marker</li>
</ul>

<ul class="square">
<li>this list has a square style list marker</li>
<li>this list has a square style list marker</li>
</ul>

<ul class="none">
<li>this list has a list marker style of none</li>
<li>this list has a list marker style of none</li>
</ul>
</body>
</html>

Use the text editor below to practice what you have learned.

Free Website Templates

Free Web Tools

Recommended Websites