简体   繁体   中英

Image as bullet point is not displayed in HTML, CSS

I have a list containing different statements. Each statement should have an individual image as a bullet point. No image is shown as a bullet point, but the normal "disc" ones.

 /* I tried different approaches like: */ #boxes .search li { list-style-image: url('./img/icons/search.svg') } 
 <section id="boxes"> <div class="advantages"> <ul id="search"> <li>My statement, which should display "search" as a bullet image</li> </ul> <ul id="time"> <li>My statement, which should display "time" as a bullet image</li> </ul> <ul id="open_folder"> <li>My statement, which should display "a folder" as a bullet image</li> </ul> <ul id="shake"> <li>My statement, which should display "a handshake" as a bullet image</li> </ul> </div> </section> 

try

#boxes li{
  background-image: url('./img/icons/search.svg')
}

EDIT from comments it sounds like you want :

#search {
   background-image: url('./img/icons/search.svg')
}

You are missing semi-colon in the css code. here's the working code-

#boxes ul#search li{
  list-style-image: url('http://css-plus.com/examples/2011/12/custom-list-style/i/tick.png');
}

OR

#boxes #search li{
  list-style-image: url('http://css-plus.com/examples/2011/12/custom-list-style/i/tick.png');
}

https://www.codeply.com/go/g747DzzOqe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM