jQuery 中的图像?
在我的应用程序中,我使用列表来显示项目。我有一个网络服务结果,我与列表绑定并将图像添加到该列表中。所以我使用类作为 ui-li-icon ,但它带有重叠的值。查看图像
listItem.innerHTML = "<img class='ui-li-icon' alt='No Image' src='"+
g_listOfBusinessDetails[i].imageURL +"'/><a href='#'
data-role='button' data-theme ='e' id='" + i + "' rel='external' data-inline='true'>" +
"<h3>"+ g_listOfBusinessDetails[i].name +"</h3>"+ "</a>";
In my application, I use list to display the items. I have a web service result and i bind with list and adding image in to that list. so I used class as ui-li-icon
but it comes with overlaps the value. see the image
listItem.innerHTML = "<img class='ui-li-icon' alt='No Image' src='"+
g_listOfBusinessDetails[i].imageURL +"'/><a href='#'
data-role='button' data-theme ='e' id='" + i + "' rel='external' data-inline='true'>" +
"<h3>"+ g_listOfBusinessDetails[i].name +"</h3>"+ "</a>";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的解决方案是删除
img
标签,而是根据您得到的响应为h3
标签指定一个类名(或通过style
设置其背景) >) 并用 css 控制其余部分。img
不属于那里:-)My solution would be to remove the
img
tags, instead give theh3
tag a classname based on the response you get (or set its background viastyle
) and control the rest with css.The
img
doesnt belong there :-)为 img 指定“ui-li-icon”类是对其进行绝对定位,这就是它与当前内容重叠的原因。
覆盖该绝对定位或使用“right: 1px”或类似命令将其移动到最右侧。您还可以为其指定自己的类并手动设置样式。
您是否浮动锚标记?
Giving the img a class of 'ui-li-icon' is absolute positioning it, which is why it is overlapping your current content.
Override that absolute positioning or move it to the far right by using 'right: 1px' or similar. You can also give it your own class and style it manually.
Are you floating the anchor tag?
在文本中添加带有 margin-left 的样式, style='margin-left:some pix or em value 根据您的图像大小'
更改您的代码,如下所示,
谢谢。
add style with margin-left to the text , style='margin-left:some pix or em value according to your image size'
change your code little bit like this
Thanks.