Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

need help with list-style-image: in css

Featured Replies

Hi

 

I might be missing something completely obvious but at the moment I cant see it......

 

I'm trying to use css to input an image as a bullet point within a list but it doesn't seem to work, can anyone help me???

 

the css code im using is:

 

li {list-style-image: url("images/icon-plus.png");}

 

the picture is in the 'images' folder within the folder for my html file

 

Thanks in advance.... Joe

 

I'd recommend you make use of psuedo elements and put the image as a background image on each psuedo element. This way you get FAR more control of the placement of the image.

Going further if you are using Icons you should be using SVGs. You can always do an SVG as a background image if you are not familar with spriting SVGs

 

e.g.

ul {
  list style: none;

}
li {
  position: relative;
}

li:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background: url('..pathname');
  content: " ";
}

Edited by rbrtsmith

  • Author

guys thank you for your imput

 

Rob, thanks for the pointer towards psuedo elements, thats definitely going to help

 

I figured out the problem, my css folder was inside my root folder, my images folder was also in my root folder and therefore when pointing towards the image via css i didnt use the grandfather route to the folder..... lesson very much learnt

 

Joe

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.