问题
I'm applying an image to a li
element in CSS, the image appears next to the li
items when I first load but then after a refresh they vanish and are replaced by bullet point. I'm using the preview option coda 2 which uses Safari but in Firefox (latest version) and Chrome (latest) the images don't even load.
My CSS code is really simple and I have no idea why this issue is taking place
ul {
list-style-image:url("images/star.png");
}
li {
margin: 10px 0px 0px 0px;
}
回答1:
Your CSS should be working. Test:
ul {
list-style-image: url(http://stater.mahdaen.name/icons/favicon-16x16.png);
}
li {
margin: 10px 0 0 0;
}
<ul class="org">
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
If your CSS is not working, then you may check this:
- Do not apply custom display to the
li
(e.ginline-block
). - Image is exist.
- List style is still not overridden by other css.
来源:https://stackoverflow.com/questions/32596026/css-images-disappear-on-refresh