简体   繁体   English

以列表样式类型而不是列表样式图像添加图像

[英]adding image in list-style-type instead of list-style-image

Please someone guide me how to show list style image in ul li in following code: 请有人指导我如何在以下代码中显示ul li中的列表样式图像:

I need to show image in list-style-type , because In my page list-style-image not working. 我需要以list-style-type显示图像,因为在我的页面中, list-style-image无法正常工作。

Here is my CSS based on list-style-image 这是我基于列表样式图像的CSS

ul.footerlist {padding-left:20px; list-style-image:url('../../images/li.png');}
ul.footerlist li{line-height:24px; }
ul.footerlist li a{color:#303030; }
ul.footerlist li a:hover{color:#0099cc; text-decoration:none;}

 ul.footerlist {padding-left:20px; list-style-type:url('https://mdn.mozillademos.org/files/11981/starsolid.gif');} ul.footerlist li{line-height:24px; } ul.footerlist li a{color:#303030; } ul.footerlist li a:hover{color:#0099cc; text-decoration:none;} 
 <ul class="footerlist go-right go-text-right"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> 

List style type will not show a custom image. 列表样式类型将不会显示自定义图像。 The documentation looks like it only shows common shapes / letters etc ( http://www.w3schools.com/cssref/pr_list-style-type.asp ) 该文档看起来仅显示常见的形状/字母等( http://www.w3schools.com/cssref/pr_list-style-type.asp

I think you should try to get List style image working again. 我认为您应该尝试使列表样式图像重新工作。

Are you sure that your image was uploaded to ../../images/li.png and that it can be viewed? 您确定您的图片已上传到../../images/li.png并且可以查看吗? Are there relative path issues or permission issues? 是否存在相对路径问题或权限问题?


Reply two: 回复二:

This piece of code seems to work correctly. 这段代码似乎正常工作。 Do you agree? 你同意吗?

 ul.footerlist {padding-left:20px; list-style-image:url('https://mdn.mozillademos.org/files/11981/starsolid.gif');} ul.footerlist li{line-height:24px; } ul.footerlist li a{color:#303030; } ul.footerlist li a:hover{color:#0099cc; text-decoration:none;} 
 <ul class="footerlist go-right go-text-right"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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