Languages
[Edit]
EN

CSS - replace unordered list bullet with image

0 points
Created by:
Lani-Skinner
408

In this article, we would like to show you how to replace unordered list bullet with image using CSS.

Practical example

In this example, we replace the unordered list bullet with the following steps:

  1. remove the existing bullet with list-style-type: none;
  2. create a new bullet from the image in the project by specifying path to the image.

CSS:

ul {
  list-style-type: none; /* remove existing bullet */
}

ul li::before {
  content: '';
  height: 20px; /*  img heidht  */
  width: 20px;  /*  img width   */
  background-image: url('images/dirask_logo.jpg'); /* image location in your project (path) */
  background-size: cover;
  display: inline-block;
  margin-left: -1em; /*  move bullet to the left (to the old bullet place)  */
}

Result:

CSS - replace unordered list bullet with image
CSS - replace unordered list bullet with image

Related posts

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join