HTML Element Style How to - Create Horizontal Bulleted Lists Using CSS








Question

We would like to know how to create Horizontal Bulleted Lists Using CSS.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {<!-- w w  w .  jav  a2  s.  com-->
  padding: 10px;
}
.list-horizontal li {
  display: inline-block;
}

.list-horizontal li:before {
  content: '\00a0\2022\00a0\00a0';
  color: #999;
  color: rgba(0, 0, 0, 0.5);
  font-size: 11px;
}

.list-horizontal li:first-child:before {
  content: '';
}
</style>
</head>
<body>
  <ul class="list-horizontal">
    <li>Inline list item #1</li>
    <li>Inline list item #2</li>
    <li>Inline list item #3</li>
    <li>Inline list item #4</li>
    <li>Inline list item #5</li>
  </ul>
</body>
</html>

The code above is rendered as follows: