By default, the HTML UL element displays a bullet (•) in front of each LI list, and the OL element displays list items marked with numbers. This list-item markers can be removed, or replaced with other symbol /character, or with an image, using CSS properties.

The examples contain the CSS and HTML code in the same place, but you should add the CSS code in the <head> section of your HTML document, or in external '.css' file.


• To remove the bullets from UL lists, or the numbering from OL lists, apply: list-style: none; to that UL /OL.
<style>
ul.nobull, ol.nobull {
 list-style: none;
}
</style>

<h4>Example removing bullets from lists</h4>

UL list.
<ul class='nobull'>
 <li>Free Courses and Tutorials</li>
 <li>CSS lessons</li>
</ul><br>

OL list.
<ol class='nobull'>
 <li>https://CoursesWeb.net/</li>
 <li>https://marplo.net/</li>
</ol>

Custom Markers / Bullets

To display a custom marker / bullet for UL / OL lists, apply list-style: none; to that UL /OL. And set the :before pseudo-class to the LI of that UL /OL, with the 'Hex code' for custom bullet to content property (the symbol must be specified in Code Hex notation).

To this page: HTML Symbol Entities there are tables with various HTML code hex entities.


- In the body of :before pseudo-class you can set the color, size, and other styles for the custom bullet.
<style>
ul.bull1, ol.bull2 {
 list-style: none;
}
ul.bull1 li:before {
 content: '\00BB'; /* code Hex notation */
 padding-right: 8px;
 color:#0000be;
}
ol.bull2 li:before {
 content: '\272C'; /* code Hex */
 padding-right: 8px;
 color:#00be00;
}
</style>

<h4>Example lists with custom bullets</h4>

UL list.
<ul class='bull1'>
 <li>Free Courses and Tutorials</li>
 <li>CSS course</li>
 <li>CSS lessons</li>
</ul><br>

OL list.
<ol class='bull2'>
 <li>https://CoursesWeb.net/</li>
 <li>https://marplo.net/</li>
</ol>
- Another way to display a custom bullet for UL / OL lists, is to replace the bullet with an image, using this syntax:
list-style-image: url('image.jpg');
- Example:
<style>
ul {
 list-style-image: url('image.jpg');
}
</style>

list-style-type

• By default, the OL element displays a numbered list, starting from 1 (1, 2, 3, ...). To set another type of numbering, like letters, roman, etc.; use the list-style-type property to that OL.
This property specifies the type of list-item marker.
- To start the numbering from other index, add start='index' attribute in the OL tag.
<style>
ol.numlatin {
 list-style-type: upper-latin;
}
ol.numdec {
 list-style-type: decimal-leading-zero;
}
</style>

<h4>Example list-style-type to OL</h4>

 - Lists with upper latin letters.
<ol class='numlatin'>
 <li>Free Courses and Tutorials</li>
 <li>Flash Games</li>
 <li>CSS lessons</li>
</ol><br>

 - Starts the numbering from the 3rd index, with decimal leading zero.
<ol class='numdec' start='3'>
 <li>MarPlo.net</li>
 <li>GamV.eu</li>
 <li>CoursesWeb.net</li>
</ol>
• Here is other types of list-item marker values for list-style-type property.

Click on each value (blue text) to see example.

list-style-position

By default, the list-item markers appear outside the content flow. To display the list-item markers /bullets inside the content flow, apply the: list-style-position: inside; property to UL /OL item.
This property specifies if the list-item markers should appear inside or outside the content flow. It can take one of these values: inside, outside, inherit.
<style>
ul.insbull, ol.insbull {
 list-style-position: inside;
}
ul li, ol li {
 border: 1px solid blue;
}
</style>

<h4>Example list-style-position: inside</h4>

 - Default.
<ul>
 <li>List 1</li>
 <li>List 2</li>
</ul><br>

 - List-item markers inside the content flow.
<ul class='insbull'>
 <li>Free Courses and Tutorials</li>
 <li>CSS course</li>
 <li>CSS lessons</li>
</ul><br>

<ol class='insbull'>
 <li>MarPlo.net</li>
 <li>CoursesWeb.net</li>
</ol>

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Click on the HTML tag which creates an horizontal line in web page.
<br /> <em> <hr />
Some content ...
<hr />
Content under line ...
Which CSS property defines the text color?
font-style font-variant color
h2 {
  color: #cbdafb;
}
Click on the function which searches if a character, or text exists in a string.
indexOf() toString() split()
var str = "Web courses - http://CoursesWeb.net/";
if(str.indexOf("http://") == -1) alert("http:// isn`t in string");
else alert("http:// is in string");
Which function splits a string into an array of strings based on a separator?
array_merge() explode() implode()
$str = "apple,banana,melon,pear";
$arr = explode(",", $str);
var_export($arr);      // array (0=>"apple", 1=>"banana", 2=>"melon", 3=>"pear")
Define Custom List-item Markers, Bullets for UL, OL Lists

Last accessed pages

  1. Multiple Select Dropdown List with JavaScript (9604)
  2. Contact page - CoursesWeb (29639)
  3. Change CSS file with jQuery (3828)
  4. Tabs effect with CSS (30300)
  5. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (36996)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (1081)
  2. Contact page - CoursesWeb (1053)
  3. Tabs effect with CSS (1049)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (451)
  5. PHP getElementById and getElementsByTagName (332)