[英]HTML with icon on left and right side
I want to create an un-order list in html. 我想在html中创建一个无序列表。 Each of list item, there will be an icon on left side and an icon on right side. 每个列表项的左侧都有一个图标,右侧有一个图标。 The text is among 2 icons and should auto occupy available screen width. 文字在2个图标中,应自动占据可用的屏幕宽度。 In the case of long text, it will be ellipsis. 如果是长文本,则为省略号。 The list item should like this: 列表项应如下所示:
++++++ ++++++++++++++++++++++++++ ++++++
+icon+ + short text + +icon+
++++++ ++++++++++++++++++++++++++ ++++++
++++++ ++++++++++++++++++++++++++ ++++++
+icon+ + long text long text ...+ +icon+
++++++ ++++++++++++++++++++++++++ ++++++
++++++ ++++++++++++++++++++++++++ ++++++
+icon+ + short text + +icon+
++++++ ++++++++++++++++++++++++++ ++++++
I tried many ways to create the list but didn't success. 我尝试了多种方法来创建列表,但没有成功。 Please help! 请帮忙! Any solution or recommends are welcome. 欢迎任何解决方案或建议。
UPDATE: I need the icons on separated tags, such as div
or img
Thanks in advance. 更新:我需要分隔标签上的图标,例如div
或img
预先感谢。
Just combine some CSS tricks: 只需结合一些CSS技巧:
ul {
margin:0;
padding:0;
}
li {
background:url(http://www.caloriedagboek.nl/_lib/img/icons/icon_help.gif) right center no-repeat;
margin:0;
overflow:hidden;
padding:0 24px 0 0;
text-overflow:ellipsis;
white-space:nowrap;
}
li:before {
content:url(http://www.caloriedagboek.nl/_lib/img/icons/icon_help.gif);
margin:0 0.5em;
}
Sample fiddle . 样品提琴 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.