EN
CSS - replace unordered list bullet with image
0
points
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:
- remove the existing bullet with
list-style-type: none;
- 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: