HTML Element Style How to - Customize bullets and color








Question

We would like to know how to customize bullets and color.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul {<!--from ww w .j  av a  2 s  .  c o m-->
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding-left: 1em;
  text-indent: -.7em;
}

li:before {
  content: "*";
  color: red; /* or whatever color you prefer */
}
</style>
</head>
<body>
  <ul>
    <li>Foo</li>
    <li>Bar</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
      do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
      enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
      ut aliquip ex ea commodo consequat. Duis aute irure dolor in
      reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
      pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
      culpa qui officia deserunt mollit anim id est laborum.</li>
  </ul>
</body>
</html>

The code above is rendered as follows: