【问题标题】:How to change the width of the column when using <display:column> and when using table-layout:fixed使用 <display:column> 和使用 table-layout:fixed 时如何更改列的宽度
【发布时间】:2013-05-27 01:29:56
【问题描述】:
我已经指定了列的宽度,但我没有看到宽度有任何变化。请帮助我。提前致谢。
我的代码:
<div style="height: auto;">
<display:table style="width:100%; position: relative;left:0px;table-layout:fixed;" pagesize="5">
<display:column sortable="true" style="width: 80%;text-align: left;word-wrap:break-word;">
</display:column>
<display:column style="width: 20%;text-align: left;" title="Date" />
</display:table>
【问题讨论】:
标签:
css
tablelayout
displaytag
【解决方案1】:
display标签不能设置宽度等css元素,因为display标签内部使用自己定义的css(diplaytag.css),jsp页面编译时调用。这里
<display:table style="width:100%;
width 属性不会影响 displaytag 的 css。因此,您必须在 displaytag.css 文件中进行更改。在你的类路径中有 displaytag.css 文件。如果没有,则将此文件添加到您的类路径中,并使用 link 属性在您的 jsp 文件中引用此文件,如下所示。
<link href="styles/displaytag.css" rel="stylesheet" type="text/css" />
在这个 css 类中,你会发现一个很大的数字。样式集,修改的是这些样式集,肯定会产生一些效果。
如果您仍然无法确定哪些 css 需要更改,那么您可以使用 firebug 检查哪些 css 应用于 displaytag-elements 并在特定样式集中进行更改。
【解决方案2】:
<display:column property="propertyNamed" headerClass="sortable" titleKey="title" style="width:100px;"/>
它对我有用...!