`
energykey
  • 浏览: 592181 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

字符串截取问题 css截取字符串注意事项

阅读更多
<div class="llist" >
	   <div class="lbar">定向营销</div>
	    <ul class="lbox01" style="height: auto;min-height: 100px;">
		<c:forEach var="item" items="${marketInfos.results}">
		  <li><div style="overflow:hidden; text-overflow:ellipsis; white-space:nowrap;max-width: 220px;font-size:13px;">
		  <a href="#" title="<c:out value="${item.content}"  escapeXml="false"/>" onclick="showThis('<c:out value="${item.title}"/>','<fmt:formatDate value="${item.createdTime}" pattern="yyyy-MM-dd hh:mm"/>',this);return false;">
		  <c:out value="${item.title}"/></a></div></li>
		</c:forEach>

这是原来的代码。

 

说一下用

style="overflow:hidden; text-overflow:ellipsis; white-space:nowrap;

这种方法要注意的问题,

1.最好加div,直接放在<li>那会出问题。放在<A>里也一样。不过IE7和FF好像行。

2.ie6在此种方式下不支持max-width.

 


故将上面的代码种的max-width修改为width后,问题得到解决

 


  • 大小: 76.2 KB
  • 大小: 12 KB
分享到:
评论
2 楼 energykey 2009-02-26  
comasp 写道

可能会截取半个 字


这个问题在FF下会出现。你们用什么截取?用代码处理?自定义标签?
1 楼 comasp 2009-02-24  
可能会截取半个 字

相关推荐

Global site tag (gtag.js) - Google Analytics